Add padding to private key encryption. Now compartible with windows version.
This commit is contained in:
parent
164a0a9e91
commit
7368cd8d4f
2 changed files with 4 additions and 0 deletions
|
|
@ -325,6 +325,9 @@ def encrypt_key():
|
|||
d = unhexlify('%064x' % client_private)[::-1]
|
||||
|
||||
m = x+y+d
|
||||
l = 16 - (len(m) % 16)
|
||||
m = m + bytes([l])*l
|
||||
|
||||
iv = get_random_bytes(AES.block_size)
|
||||
aes = AES.new(psk_encryption_key, AES.MODE_CBC, iv)
|
||||
c = iv + aes.encrypt(m)
|
||||
|
|
|
|||
1
tls97.py
1
tls97.py
|
|
@ -478,6 +478,7 @@ class Tls():
|
|||
iv, c = c[:AES.block_size], c[AES.block_size:]
|
||||
aes=AES.new(psk_encryption_key, AES.MODE_CBC, iv)
|
||||
m=aes.decrypt(c)
|
||||
m=m[:-m[-1]] # unpad (standard this time)
|
||||
|
||||
x, m = m[:0x20], m[0x20:]
|
||||
y, m = m[:0x20], m[0x20:]
|
||||
|
|
|
|||
Loading…
Reference in a new issue