Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2014-04-11 15:38:10 +0200
committerArthur de Jong <arthur@arthurdejong.org>2014-04-11 15:41:24 +0200
commit6446f7d30ea4d6b5c4f38ce99e071bb9add25ce1 (patch)
tree92ca49b59499f97daf46f0d3d9ccad3910f48d49 /tests
parente72369f0b747a3267b7cf8f2ce3b8710805449c2 (diff)
Add test for Figure 4 from RFC6030
This tests for key profile and key reference properties that can be used to reference external keys.
Diffstat (limited to 'tests')
-rw-r--r--tests/rfc6030-figure4.pskc38
-rw-r--r--tests/test_rfc6030.doctest16
2 files changed, 54 insertions, 0 deletions
diff --git a/tests/rfc6030-figure4.pskc b/tests/rfc6030-figure4.pskc
new file mode 100644
index 0000000..981ccb2
--- /dev/null
+++ b/tests/rfc6030-figure4.pskc
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Example of a PSKC Document Transmitting an HOTP Key via Key Derivation
+ Values from RFC6030 (Figure 4).
+-->
+
+<KeyContainer Version="1.0"
+ Id="exampleID1"
+ xmlns="urn:ietf:params:xml:ns:keyprov:pskc">
+ <KeyPackage>
+ <DeviceInfo>
+ <Manufacturer>Manufacturer</Manufacturer>
+ <SerialNo>987654321</SerialNo>
+ </DeviceInfo>
+ <CryptoModuleInfo>
+ <Id>CM_ID_001</Id>
+ </CryptoModuleInfo>
+ <Key Id="12345678"
+ Algorithm="urn:ietf:params:xml:ns:keyprov:pskc:hotp">
+ <Issuer>Issuer</Issuer>
+ <AlgorithmParameters>
+ <ResponseFormat Length="8" Encoding="DECIMAL"/>
+ </AlgorithmParameters>
+ <KeyProfileId>keyProfile1</KeyProfileId>
+ <KeyReference>MasterKeyLabel
+ </KeyReference>
+ <Data>
+ <Counter>
+ <PlainValue>0</PlainValue>
+ </Counter>
+ </Data>
+ <Policy>
+ <KeyUsage>OTP</KeyUsage>
+ </Policy>
+ </Key>
+ </KeyPackage>
+</KeyContainer>
diff --git a/tests/test_rfc6030.doctest b/tests/test_rfc6030.doctest
index 1dd163e..5e131e0 100644
--- a/tests/test_rfc6030.doctest
+++ b/tests/test_rfc6030.doctest
@@ -70,3 +70,19 @@ parameters.
0
>>> key.userid
'UID=jsmith,DC=example-bank,DC=net'
+
+
+This tests Figure 4 from RFC6030. In this case the key value itself is not
+contained but can be derived using the serial and out-of-band agreements
+on the meanings of key_profile and key_reference.
+
+>>> pskc = PSKC('tests/rfc6030-figure4.pskc')
+>>> key = pskc.keys[0]
+>>> key.serial
+'987654321'
+>>> key.key_profile
+'keyProfile1'
+>>> key.key_reference
+'MasterKeyLabel'
+>>> key.counter
+0