Skip to content

Commit

Permalink
Fixes to key localization code for AES192/256
Browse files Browse the repository at this point in the history
  • Loading branch information
etingof committed Aug 21, 2016
1 parent 236178f commit c9c3d13
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pysnmp/proto/secmod/eso/priv/aesbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ def localizeKey(self, authProtocol, privKey, snmpEngineID):
localPrivKey = localkey.localizeKeyMD5(privKey, snmpEngineID)
# now extend this key if too short by repeating steps that includes the hashPassphrase step
while len(localPrivKey) < self.keySize:
newKey = hashPassphraseMD5(localPrivKey) # this is the difference between reeder and bluementhal
localPrivKey += localizeKeyMD5(newKey, snmpEngineID)
newKey = localkey.hashPassphraseMD5(localPrivKey) # this is the difference between reeder and bluementhal
localPrivKey += localkey.localizeKeyMD5(newKey, snmpEngineID)
elif authProtocol == hmacsha.HmacSha.serviceID:
localPrivKey = localkey.localizeKeySHA(privKey, snmpEngineID)
while len(localPrivKey < self.keySize):
newKey = hashPassphraseSHA(localPrivKey)
localPrivKey += localizeKeySHA(newKey, snmpEngineID)
while len(localPrivKey) < self.keySize:
newKey = localkey.hashPassphraseSHA(localPrivKey)
localPrivKey += localkey.localizeKeySHA(newKey, snmpEngineID)
else:
raise error.ProtocolError(
'Unknown auth protocol %s' % (authProtocol,)
Expand Down

0 comments on commit c9c3d13

Please sign in to comment.