mirror of
https://gitlab.gnome.org/GNOME/libsecret.git
synced 2024-12-22 12:48:51 +00:00
mock: Pad the common secret with zero bytes to make it exactly 128 bytes long
This is what the C code does, see egg/egg-dh.c:340. https://bugzilla.gnome.org/show_bug.cgi?id=768112
This commit is contained in:
parent
3e5c18bcc2
commit
d3ac1c1834
@ -84,6 +84,8 @@ class AesAlgorithm():
|
|||||||
# print "mock publi: ", hex(publi)
|
# print "mock publi: ", hex(publi)
|
||||||
# print " mock peer: ", hex(peer)
|
# print " mock peer: ", hex(peer)
|
||||||
ikm = dh.derive_key(privat, peer)
|
ikm = dh.derive_key(privat, peer)
|
||||||
|
# Pad the secret with zero bytes to match length of prime in bytes.
|
||||||
|
ikm = b'\x00' * (128 - len(ikm)) + ikm
|
||||||
# print " mock ikm: ", hex_encode(ikm)
|
# print " mock ikm: ", hex_encode(ikm)
|
||||||
key = hkdf.hkdf(ikm, 16)
|
key = hkdf.hkdf(ikm, 16)
|
||||||
# print " mock key: ", hex_encode(key)
|
# print " mock key: ", hex_encode(key)
|
||||||
|
Loading…
Reference in New Issue
Block a user