diff options
author | Ilya Etingof <etingof@gmail.com> | 2017-12-30 15:55:13 +0100 |
---|---|---|
committer | Ilya Etingof <etingof@gmail.com> | 2017-12-30 15:55:13 +0100 |
commit | 87dee74cacded799187d66107858364c332cc231 (patch) | |
tree | 2bd7b9679fba48c632c9e61351b70c107b8e4cea /pysnmp | |
parent | 8b4c122b6781115635ca130900765bfc85af19a7 (diff) | |
download | pysnmp-git-87dee74cacded799187d66107858364c332cc231.tar.gz |
fixed 3DES key localization bug
Diffstat (limited to 'pysnmp')
-rw-r--r-- | pysnmp/__init__.py | 2 | ||||
-rw-r--r-- | pysnmp/proto/secmod/eso/priv/des3.py | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/pysnmp/__init__.py b/pysnmp/__init__.py index 2e607091..168d8d7c 100644 --- a/pysnmp/__init__.py +++ b/pysnmp/__init__.py @@ -1,5 +1,5 @@ # http://www.python.org/dev/peps/pep-0396/ -__version__ = '4.4.3' +__version__ = '4.4.4' # backward compatibility version = tuple([int(x) for x in __version__.split('.')]) majorVersionId = version[0] diff --git a/pysnmp/proto/secmod/eso/priv/des3.py b/pysnmp/proto/secmod/eso/priv/des3.py index d5022089..97ba156d 100644 --- a/pysnmp/proto/secmod/eso/priv/des3.py +++ b/pysnmp/proto/secmod/eso/priv/des3.py @@ -68,6 +68,13 @@ class Des3(base.AbstractEncryptionService): 'Unknown auth protocol %s' % (authProtocol,) ) localPrivKey = localkey.localizeKey(privKey, snmpEngineID, hashAlgo) + + # now extend this key if too short by repeating steps that includes the hashPassphrase step + while len(localPrivKey) < self.keySize: + # this is the difference between reeder and bluementhal + newKey = localkey.hashPassphrase(localPrivKey, hashAlgo) + localPrivKey += localkey.localizeKey(newKey, snmpEngineID, hashAlgo) + return localPrivKey[:self.keySize] # 5.1.1.1 |