Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/tests/test_draft_keyprov.doctest
blob: acd339300502c3d032ea2fc3b96a83fa5b9428ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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']