[preview] Add back 12 byte IV read support
This commit is contained in:
@@ -271,10 +271,19 @@ def parse_fragment(fragment):
|
|||||||
raise ValueError('Invalid fragment')
|
raise ValueError('Invalid fragment')
|
||||||
|
|
||||||
fragment = binascii.unhexlify(fragment)
|
fragment = binascii.unhexlify(fragment)
|
||||||
key = fragment[16:]
|
size = len(fragment)
|
||||||
iv = fragment[:16]
|
# Clients started out with using a 16 byte IV but long term
|
||||||
if len(key) != 32 or len(iv) != 16:
|
# want to swtich to the more performant 12 byte IV
|
||||||
raise ValueError('Invalid fragment')
|
# We have to support both
|
||||||
|
if size == 48:
|
||||||
|
key = fragment[16:]
|
||||||
|
iv = fragment[:16]
|
||||||
|
elif size == 44:
|
||||||
|
key = fragment[12:]
|
||||||
|
iv = fragment[:12]
|
||||||
|
else:
|
||||||
|
raise ValueError('Invalid fragment size: %s' % size)
|
||||||
|
|
||||||
return key, iv
|
return key, iv
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user