Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/pskc/key.py
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2016-03-19 20:01:46 +0100
committerArthur de Jong <arthur@arthurdejong.org>2016-03-19 20:44:26 +0100
commitb8905e0b2d995e46190c30f8c7525839036a92d5 (patch)
tree660e576d737966af5c729636a6ef8c45c6485a10 /pskc/key.py
parent7915c559aa388f6354a6d79c2b5bb2c29e526334 (diff)
Support both CheckDigit and CheckDigits
RFC 6030 is not clear about whether the attribute of ChallengeFormat and ResponseFormat should be the singular CheckDigit or the plural CheckDigits. This ensures that both forms are accepted.
Diffstat (limited to 'pskc/key.py')
-rw-r--r--pskc/key.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/pskc/key.py b/pskc/key.py
index 3df4055..a971bdd 100644
--- a/pskc/key.py
+++ b/pskc/key.py
@@ -312,7 +312,9 @@ class Key(object):
self.challenge_encoding = challenge_format.get('Encoding')
self.challenge_min_length = getint(challenge_format, 'Min')
self.challenge_max_length = getint(challenge_format, 'Max')
- self.challenge_check = getbool(challenge_format, 'CheckDigits')
+ self.challenge_check = getbool(
+ challenge_format, 'CheckDigits', getbool(
+ challenge_format, 'CheckDigit'))
response_format = find(
key_package,
@@ -320,7 +322,9 @@ class Key(object):
if response_format is not None:
self.response_encoding = response_format.get('Encoding')
self.response_length = getint(response_format, 'Length')
- self.response_check = getbool(response_format, 'CheckDigits')
+ self.response_check = getbool(
+ response_format, 'CheckDigits', getbool(
+ response_format, 'CheckDigit'))
self.policy.parse(find(key_package, 'Key/Policy'))