RE: PSKC XML ActivIdentity format

Jaap Ruijgrok
Sat, 17 Dec 2016 21:41:58 GMT

Hello Arthur,
I commented out the version lines in __init__.py
And then ran the following:

>>> from binascii import a2b_hex, b2a_hex
>>> from pskc import PSKC
>>> pskc = PSKC('test.pskc')
>>> a2b_hex('************')#Transportkey obfuscated
'\xc7;\x1cu\xb2;\x06\xdah\x89xC\xb3\xe4\xc0\xf6'

I then tried to print some info:

>>> for key in pskc.keys:
... print key.id, b2a_hex(key.secret), key.counter
  File "<stdin>", line 2
    print key.id, b2a_hex(key.secret), key.counter
        ^
IndentationError: expected an indented block

As I'm not familiar with Python at all ;-)) I need some help here.
I will send you the transport key separately.
Thanks in advance.
Kind regards,
Jaap

>>> from binascii import a2b_hex, b2a_hex
>>> from pskc import PSKC
>>> pskc = PSKC('test.pskc')
>>> a2b_hex('C73B1C75B23B06DA68897843B3E4C0F6')
'\xc7;\x1cu\xb2;\x06\xdah\x89xC\xb3\xe4\xc0\xf6'
>>> for key in pskc.keys:
... print key.id, b2a_hex(key.secret), key.counter
  File "<stdin>", line 2
    print key.id, b2a_hex(key.secret), key.counter
        ^
IndentationError: expected an indented block

Jaap Ruijgrok
Security Consultant
Straat van Florida 11
1334PA Almere
Tel 0365393100 Mobile:0620956932
mailto:JRuijgrok@avensus.nl

------------------------------------------------------------------------------------------------------------
Disclaimer:
This message (including any attachments) may be privileged or confidential.
If you have received it by mistake, please notify the sender by return e-mail
and delete this message from your system.
Any unauthorised use or dissemination of this message in whole or in part is
strictly prohibited.
Avensus Nederland B.V. is registered with the Dutch KvK (Dutch chambers of
commerce) in Almere under registration number: 05068877
------------------------------------------------------------------------------------------------------------

-----Original Message-----
From: python-pskc-users
[mailto:python-pskc-users-bounces+jruijgrok=avensus.nl@lists.arthurdejong.org]
On Behalf Of Arthur de Jong
Sent: zaterdag 17 december 2016 21:38
To: Jaap Ruijgrok <JRuijgrok@avensus.nl>;
python-pskc-users@lists.arthurdejong.org
Subject: Re: PSKC XML ActivIdentity format

On Sat, 2016-12-17 at 19:30 +0000, Jaap Ruijgrok wrote:
> I try to use python-pskc/0.4 to read a PSKC XML file provided with
> OATH compliant ActivIdentity tokens; see attachment.
> It is supposed to be RFC 6020 compliant and the encryption method is
> AES 128 CBC.
> I do have the corresponding ‘transport key’.
> However, I’m not sure how to process this using the python-pskc tool.
> Output received so far:
> >>> from pskc import PSKC
> >>> pskc = PSKC('test.pskc')
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/usr/local/lib/python2.7/dist-packages/pskc/__init__.py",
> line 79, in __init__
>     self.parse(tree.getroot())
>   File "/usr/local/lib/python2.7/dist-packages/pskc/__init__.py",
> line 93, in parse
>     raise ParseError('Unsupported version %r' % self.version)
> pskc.exceptions.ParseError: Unsupported version None

The problem is that the KeyContainer element in the provided PSKC file has a
version attribute (all lower case) while RFC 6030 specifies a Version attribute
(first letter should be a capital). I'll look into making the attribute name
matching case insensitive.

As a work-around for now you can comment out raising of ParseError on line 93
of __init__.py.

You should then be able to do something like:

>>> from binascii import a2b_hex, b2a_hex from pskc import PSKC pskc =
>>> PSKC('test.pskc') pskc.encryption.key =
>>> a2b_hex('12345678901234567890123456789012')
>>> for key in pskc.keys:
...     print key.id, b2a_hex(key.secret), key.counter

You have to replace the value you pass to set up the encryption key correctly
(transport key). The example above is for a hex-encoded value. The PSKC module
expects a binary value for the key.

I would like to add the ActivIdentity file to the test suite. Do you have one
with a corresponding transport key?

Kind regards,