Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2014-05-31 16:03:28 +0200
committerArthur de Jong <arthur@arthurdejong.org>2014-05-31 18:29:34 +0200
commitba49d09d9c47f08f71d3af9336fda34cb9b23a96 (patch)
treef12421aa785643ad315ead3c4a6d3ffbe4e40a40
parent0a66edef93fa09c6fab800e61afda6f1d0f0a408 (diff)
Add an OCRA test
The test is taken from draft-hoyer-keyprov-pskc-algorithm-profiles-01 modified to fit the schema as described in RFC 6030.
-rw-r--r--tests/draft-keyprov-ocra.pskcxml34
-rw-r--r--tests/test_draft_keyprov.doctest58
2 files changed, 92 insertions, 0 deletions
diff --git a/tests/draft-keyprov-ocra.pskcxml b/tests/draft-keyprov-ocra.pskcxml
new file mode 100644
index 0000000..5519159
--- /dev/null
+++ b/tests/draft-keyprov-ocra.pskcxml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ OCRA (OATH Challenge Response Algorithm) example from section 3 of
+ draft-hoyer-keyprov-pskc-algorithm-profiles-01 modified to fit the schema
+ as described in RFC 6030.
+-->
+
+<KeyContainer Version="1.0" xmlns="urn:ietf:params:xml:ns:keyprov:pskc">
+ <KeyPackage>
+ <DeviceInfo>
+ <Manufacturer>TokenVendorAcme</Manufacturer>
+ <SerialNo>987654322</SerialNo>
+ </DeviceInfo>
+ <Key Id="12345678" Algorithm="urn:ietf:params:xml:ns:keyprov:pskc#OCRA-1:HOTP-SHA512-8:C-QN08">
+ <Issuer>Issuer</Issuer>
+ <AlgorithmParameters>
+ <ChallengeFormat Min="8" Max="8" Encoding="DECIMAL"/>
+ <ResponseFormat Length="8" Encoding="DECIMAL"/>
+ </AlgorithmParameters>
+ <Data>
+ <Secret>
+ <PlainValue>MTIzNDU2Nzg5MDEyMzQ1Njc4OTA=</PlainValue>
+ </Secret>
+ <Counter>
+ <PlainValue>0</PlainValue>
+ </Counter>
+ </Data>
+ <Policy>
+ <KeyUsage>CR</KeyUsage>
+ </Policy>
+ </Key>
+ </KeyPackage>
+</KeyContainer>
diff --git a/tests/test_draft_keyprov.doctest b/tests/test_draft_keyprov.doctest
new file mode 100644
index 0000000..acd3393
--- /dev/null
+++ b/tests/test_draft_keyprov.doctest
@@ -0,0 +1,58 @@
+test_draft_keyprov.doctest - test for examples from
+ draft-hoyer-keyprov-pskc-algorithm-profiles-01
+
+Copyright (C) 2014 Arthur de Jong
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA
+
+
+>>> from pskc import PSKC
+
+
+This tests an OCRA (OATH Challenge Response Algorithm) key contained within
+a PSKC file as described in section 3 of
+draft-hoyer-keyprov-pskc-algorithm-profiles-01.
+
+>>> pskc = PSKC('tests/draft-keyprov-ocra.pskcxml')
+>>> pskc.version
+'1.0'
+>>> key = pskc.keys[0]
+>>> key.manufacturer
+'TokenVendorAcme'
+>>> key.serial
+'987654322'
+>>> key.id
+'12345678'
+>>> key.algorithm
+'urn:ietf:params:xml:ns:keyprov:pskc#OCRA-1:HOTP-SHA512-8:C-QN08'
+>>> key.issuer
+'Issuer'
+>>> key.challenge_encoding
+'DECIMAL'
+>>> key.challenge_min_length
+8
+>>> key.challenge_max_length
+8
+>>> key.response_encoding
+'DECIMAL'
+>>> key.response_length
+8
+>>> key.secret
+'12345678901234567890'
+>>> key.counter
+0
+>>> key.policy.key_usage
+['CR']