1
test_draft_keyprov.doctest - test for examples from
2
draft-hoyer-keyprov-pskc-algorithm-profiles-01
4
Copyright (C) 2014 Arthur de Jong
6
This library is free software; you can redistribute it and/or
7
modify it under the terms of the GNU Lesser General Public
8
License as published by the Free Software Foundation; either
9
version 2.1 of the License, or (at your option) any later version.
11
This library is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
Lesser General Public License for more details.
16
You should have received a copy of the GNU Lesser General Public
17
License along with this library; if not, write to the Free Software
18
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22
>>> from pskc import PSKC
25
This tests an OCRA (OATH Challenge Response Algorithm) key contained within
26
a PSKC file as described in section 3 of
27
draft-hoyer-keyprov-pskc-algorithm-profiles-01.
29
>>> pskc = PSKC('tests/draft-keyprov-ocra.pskcxml')
32
>>> key = pskc.keys[0]
40
'urn:ietf:params:xml:ns:keyprov:pskc#OCRA-1:HOTP-SHA512-8:C-QN08'
43
>>> key.challenge_encoding
45
>>> key.challenge_min_length
47
>>> key.challenge_max_length
49
>>> key.response_encoding
51
>>> key.response_length
54
'12345678901234567890'
57
>>> key.policy.key_usage
61
This tests an TOTP (OATH Time based OTP) key contained within a PSKC file as
62
described in section 4 of draft-hoyer-keyprov-pskc-algorithm-profiles-01.
64
>>> pskc = PSKC('tests/draft-keyprov-totp.pskcxml')
67
>>> key = pskc.keys[0]
75
'urn:ietf:params:xml:ns:keyprov:pskc#totp'
78
>>> key.response_encoding
80
>>> key.response_length
83
'12345678901234567890'
90
>>> key.policy.key_usage
94
This tests an SecurID-AES-Counter key contained within a PSKC file as
95
described in section 6 of draft-hoyer-keyprov-pskc-algorithm-profiles-01.
97
>>> pskc = PSKC('tests/draft-keyprov-securid-aes-counter.pskcxml')
100
>>> key = pskc.keys[0]
102
'RSA, The Security Division of EMC'
108
'http://www.rsa.com/names/2008/04/algorithms/SecurID/SecurID-AES128-Counter'
111
>>> key.response_encoding
113
>>> key.response_length
116
'12345678901234567890'
119
>>> key.policy.key_usage
121
>>> key.policy.start_date
122
datetime.datetime(2006, 4, 14, 0, 0, tzinfo=tzutc())
123
>>> key.policy.expiry_date
124
datetime.datetime(2010, 9, 30, 0, 0, tzinfo=tzutc())
127
This tests an ActivIdentity-3DES key contained within a PSKC file as
128
described in section 8 of draft-hoyer-keyprov-pskc-algorithm-profiles-01.
130
>>> pskc = PSKC('tests/draft-keyprov-actividentity-3des.pskcxml')
133
>>> key = pskc.keys[0]
141
'http://www.actividentity.com/2008/04/algorithms/algorithms#ActivIdentity-3DES'
144
>>> key.response_encoding
146
>>> key.response_length
149
'12345678901234567890'
154
>>> key.time_interval
158
>>> key.policy.key_usage