From ba49d09d9c47f08f71d3af9336fda34cb9b23a96 Mon Sep 17 00:00:00 2001 From: Arthur de Jong Date: Sat, 31 May 2014 16:03:28 +0200 Subject: 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. --- tests/draft-keyprov-ocra.pskcxml | 34 +++++++++++++++++++++++ tests/test_draft_keyprov.doctest | 58 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 tests/draft-keyprov-ocra.pskcxml create mode 100644 tests/test_draft_keyprov.doctest 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 @@ + + + + + + + + TokenVendorAcme + 987654322 + + + Issuer + + + + + + + MTIzNDU2Nzg5MDEyMzQ1Njc4OTA= + + + 0 + + + + CR + + + + 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'] -- cgit v1.2.3