mirror of
https://github.com/xcat2/confluent.git
synced 2024-11-22 17:43:14 +00:00
Auto-encode unicode if needed
If unicode comes in to be crypted and fails, be explicit about utf-8 encoding.
This commit is contained in:
parent
aeb3bd2444
commit
0745ab0fdf
@ -261,7 +261,10 @@ def crypt_value(value,
|
||||
neededpad = 16 - (len(value) % 16)
|
||||
pad = chr(neededpad) * neededpad
|
||||
value += pad
|
||||
cryptval = crypter.encrypt(value)
|
||||
try:
|
||||
cryptval = crypter.encrypt(value)
|
||||
except TypeError:
|
||||
cryptval = crypter.encrypt(value.encode('utf-8'))
|
||||
hmac = HMAC.new(integritykey, cryptval, SHA256).digest()
|
||||
return iv, cryptval, hmac
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user