Skip to content

Commit

Permalink
fixed 3DES key localization bug
Browse files Browse the repository at this point in the history
  • Loading branch information
etingof committed Dec 30, 2017
1 parent 8b4c122 commit 87dee74
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@

Revision 4.4.4, released 2017-12-XX
-----------------------------------

- Fixed short local key expansion at 3DES key localization
implementation.

Revision 4.4.3, released 2017-12-22
-----------------------------------

Expand Down
2 changes: 1 addition & 1 deletion pysnmp/__init__.py
Original file line number Diff line number Diff line change
@@ -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]
7 changes: 7 additions & 0 deletions pysnmp/proto/secmod/eso/priv/des3.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ def localizeKey(self, authProtocol, privKey, snmpEngineID):
'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
Expand Down

0 comments on commit 87dee74

Please sign in to comment.