Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2014-05-29 14:49:05 +0200
committerArthur de Jong <arthur@arthurdejong.org>2014-05-29 14:50:07 +0200
commit76ef42bf1009e542b90814dc0b629e0ee5b0356c (patch)
tree0371ed999f3b492788c3b3f1bec09fc47c4047e0 /tests
parent7f26dc68c898ed7465a621d4f77544f473437491 (diff)
Add test for missing key encryption algorithm
This also introduces a toplevel PSKCError exception that all exceptions have as parent.
Diffstat (limited to 'tests')
-rw-r--r--tests/invalid-encryption.pskcxml18
-rw-r--r--tests/test_invalid.doctest7
2 files changed, 24 insertions, 1 deletions
diff --git a/tests/invalid-encryption.pskcxml b/tests/invalid-encryption.pskcxml
index 18ee5f1..d900dc9 100644
--- a/tests/invalid-encryption.pskcxml
+++ b/tests/invalid-encryption.pskcxml
@@ -2,7 +2,7 @@
<!--
Based on the Figure 6 example, this file includes an unknown encryption
- algorithm.
+ algorithm and a key without an algorithm specified.
-->
<KeyContainer Version="1.0"
@@ -28,4 +28,20 @@ AAECAwQFBgcICQoLDA0OD+cIHItlB3Wra1DUpxVvOx2lef1VmNPCMl8jwZqIUqGv
</Data>
</Key>
</KeyPackage>
+ <KeyPackage>
+ <Key Id="45678901" Algorithm="urn:ietf:params:xml:ns:keyprov:pskc:hotp">
+ <Data>
+ <Secret>
+ <EncryptedValue>
+ <xenc:EncryptionMethod/>
+ <xenc:CipherData>
+ <xenc:CipherValue>
+AAECAwQFBgcICQoLDA0OD+cIHItlB3Wra1DUpxVvOx2lef1VmNPCMl8jwZqIUqGv
+ </xenc:CipherValue>
+ </xenc:CipherData>
+ </EncryptedValue>
+ </Secret>
+ </Data>
+ </Key>
+ </KeyPackage>
</KeyContainer>
diff --git a/tests/test_invalid.doctest b/tests/test_invalid.doctest
index 2665bae..7c291e1 100644
--- a/tests/test_invalid.doctest
+++ b/tests/test_invalid.doctest
@@ -55,3 +55,10 @@ DecryptionError: No key available
Traceback (most recent call last):
...
DecryptionError: Unsupported algorithm: ...
+>>> key = pskc.keys[1]
+>>> key.id
+'45678901'
+>>> key.secret
+Traceback (most recent call last):
+ ...
+DecryptionError: No algorithm specified