python-pskc branch master updated. 6446f7d30ea4d6b5c4f38ce99e071bb9add25ce1
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
python-pskc branch master updated. 6446f7d30ea4d6b5c4f38ce99e071bb9add25ce1
- From: Commits of the python-pskc project <python-pskc-commits [at] lists.arthurdejong.org>
- To: python-pskc-commits [at] lists.arthurdejong.org
- Reply-to: python-pskc-users [at] lists.arthurdejong.org
- Subject: python-pskc branch master updated. 6446f7d30ea4d6b5c4f38ce99e071bb9add25ce1
- Date: Fri, 11 Apr 2014 15:42:02 +0200 (CEST)
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "python-pskc".
The branch, master has been updated
via 6446f7d30ea4d6b5c4f38ce99e071bb9add25ce1 (commit)
via e72369f0b747a3267b7cf8f2ce3b8710805449c2 (commit)
via 2c111a8dc991b6d4ca1879ec57a8fa200aebbfee (commit)
from 96b4b54546a33b580b4c367f26d02955782b451d (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://arthurdejong.org/git/python-pskc/commit/?id=6446f7d30ea4d6b5c4f38ce99e071bb9add25ce1
commit 6446f7d30ea4d6b5c4f38ce99e071bb9add25ce1
Author: Arthur de Jong <arthur@arthurdejong.org>
Date: Fri Apr 11 15:38:10 2014 +0200
Add test for Figure 4 from RFC6030
This tests for key profile and key reference properties that can be used
to reference external keys.
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
http://arthurdejong.org/git/python-pskc/commit/?id=e72369f0b747a3267b7cf8f2ce3b8710805449c2
commit e72369f0b747a3267b7cf8f2ce3b8710805449c2
Author: Arthur de Jong <arthur@arthurdejong.org>
Date: Mon Apr 7 23:09:13 2014 +0200
Add test for Figure 3 from RFC6030
This tests Figure 3 from RFC6030 with a very basic plain text secret key
and some supplementary data.
diff --git a/tests/rfc6030-figure3.pskc b/tests/rfc6030-figure3.pskc
new file mode 100644
index 0000000..417131d
--- /dev/null
+++ b/tests/rfc6030-figure3.pskc
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ PSKC Key Container Example with Supplementary Data from RFC6030 (Figure 3).
+-->
+
+<KeyContainer Version="1.0"
+ Id="exampleID1"
+ xmlns="urn:ietf:params:xml:ns:keyprov:pskc">
+ <KeyPackage>
+ <DeviceInfo>
+ <Manufacturer>Manufacturer</Manufacturer>
+ <SerialNo>987654321</SerialNo>
+ <UserId>DC=example-bank,DC=net</UserId>
+ </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>
+ <Data>
+ <Secret>
+ <PlainValue>MTIzNDU2Nzg5MDEyMzQ1Njc4OTA=
+ </PlainValue>
+ </Secret>
+ <Counter>
+ <PlainValue>0</PlainValue>
+ </Counter>
+ </Data>
+ <UserId>UID=jsmith,DC=example-bank,DC=net</UserId>
+ </Key>
+ </KeyPackage>
+</KeyContainer>
diff --git a/tests/test-rfc6030.doctest b/tests/test_rfc6030.doctest
similarity index 63%
rename from tests/test-rfc6030.doctest
rename to tests/test_rfc6030.doctest
index 59d9829..1dd163e 100644
--- a/tests/test-rfc6030.doctest
+++ b/tests/test_rfc6030.doctest
@@ -36,3 +36,37 @@ a simple plain text secret key.
'Issuer-A'
>>> key.secret
'1234'
+
+
+This tests Figure 3 from RFC6030. Relative to Figure 2 this includes
+device, cryptographic module and user identification as well as some more
+parameters.
+
+>>> pskc = PSKC('tests/rfc6030-figure3.pskc')
+>>> pskc.id
+'exampleID1'
+>>> key = pskc.keys[0]
+>>> key.manufacturer
+'Manufacturer'
+>>> key.serial
+'987654321'
+>>> key.device_userid
+'DC=example-bank,DC=net'
+>>> key.crypto_module
+'CM_ID_001'
+>>> key.id
+'12345678'
+>>> key.algorithm
+'urn:ietf:params:xml:ns:keyprov:pskc:hotp'
+>>> key.issuer
+'Issuer'
+>>> key.response_encoding
+'DECIMAL'
+>>> key.response_length
+8
+>>> key.secret
+'12345678901234567890'
+>>> key.counter
+0
+>>> key.userid
+'UID=jsmith,DC=example-bank,DC=net'
http://arthurdejong.org/git/python-pskc/commit/?id=2c111a8dc991b6d4ca1879ec57a8fa200aebbfee
commit 2c111a8dc991b6d4ca1879ec57a8fa200aebbfee
Author: Arthur de Jong <arthur@arthurdejong.org>
Date: Mon Apr 7 23:26:49 2014 +0200
Get more data from KeyPackage
This gets most simple string values from the KeyPackage as well as some
integer and boolean values.
diff --git a/pskc/parse.py b/pskc/parse.py
index f64ad14..1c91054 100644
--- a/pskc/parse.py
+++ b/pskc/parse.py
@@ -93,6 +93,8 @@ class Key(object):
# TODO: handle <ExpiryDate> as datetime
self.device_userid = g_e_v(key_package, 'pskc:DeviceInfo/pskc:UserId')
+ self.crypto_module = g_e_v(key_package,
'pskc:CryptoModuleInfo/pskc:Id')
+
self.id = None
self.algorithm = None
@@ -102,6 +104,46 @@ class Key(object):
self.algorithm = key.attrib.get('Algorithm')
self.issuer = g_e_v(key_package, 'pskc:Key/pskc:Issuer')
+ self.key_profile = g_e_v(key_package, 'pskc:Key/pskc:KeyProfileId')
+ self.key_reference = g_e_v(key_package, 'pskc:Key/pskc:KeyReference')
+ self.friendly_name = g_e_v(key_package, 'pskc:Key/pskc:FriendlyName')
+ # TODO: support multi-language values of <FriendlyName>
+ self.userid = g_e_v(key_package, 'pskc:Key/pskc:UserId')
+
+ self.algorithm_suite = g_e_v(key_package,
'pskc:Key/pskc:AlgorithmParameters/pskc:Suite')
+
+ self.challenge_encoding = None
+ self.challenge_min = None
+ self.challenge_max = None
+ self.challenge_check = None
+
+ challenge_format =
key_package.find('pskc:Key/pskc:AlgorithmParameters/pskc:ChallengeFormat',
namespaces=namespaces)
+ if challenge_format is not None:
+ self.challenge_encoding = challenge_format.attrib.get('Encoding')
+ v = challenge_format.attrib.get('Min')
+ if v:
+ self.challenge_min = int(v)
+ v = challenge_format.attrib.get('Max')
+ if v:
+ self.challenge_max = int(v)
+ v = challenge_format.attrib.get('CheckDigits')
+ if v:
+ self.challenge_check = v.lower() == 'true'
+
+ self.response_encoding = None
+ self.response_length = None
+ self.response_check = None
+
+ response_format =
key_package.find('pskc:Key/pskc:AlgorithmParameters/pskc:ResponseFormat',
namespaces=namespaces)
+ if response_format is not None:
+ self.response_encoding = response_format.attrib.get('Encoding')
+ v = response_format.attrib.get('Length')
+ if v:
+ self.response_length = int(v)
+ v = response_format.attrib.get('CheckDigits')
+ if v:
+ self.response_check = v.lower() == 'true'
+
self.secret = None
self.counter = None
self.time_offset = None
-----------------------------------------------------------------------
Summary of changes:
pskc/parse.py | 42 ++++++++++++++++
tests/rfc6030-figure3.pskc | 37 +++++++++++++++
tests/rfc6030-figure4.pskc | 38 +++++++++++++++
.../{test-rfc6030.doctest => test_rfc6030.doctest} | 50 ++++++++++++++++++++
4 files changed, 167 insertions(+)
create mode 100644 tests/rfc6030-figure3.pskc
create mode 100644 tests/rfc6030-figure4.pskc
rename tests/{test-rfc6030.doctest => test_rfc6030.doctest} (52%)
hooks/post-receive
--
python-pskc
--
To unsubscribe send an email to
python-pskc-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/python-pskc-commits/
- python-pskc branch master updated. 6446f7d30ea4d6b5c4f38ce99e071bb9add25ce1,
Commits of the python-pskc project