Fix bug related to keyczar messing up encodings

Also increases default AES key size to 256 for accelerated keys.
This commit is contained in:
James Cammarata 2015-07-02 15:04:57 -04:00
parent c15a6cc634
commit 051d04c8d7

View file

@ -140,7 +140,7 @@ def key_for_hostname(hostname):
# use new AES keys every 2 hours, which means fireball must not allow running for longer either
if not os.path.exists(key_path) or (time.time() - os.path.getmtime(key_path) > 60*60*2):
key = AesKey.Generate()
key = AesKey.Generate(size=256)
fd = os.open(key_path, os.O_WRONLY | os.O_CREAT, int(C.ACCELERATE_KEYS_FILE_PERMS, 8))
fh = os.fdopen(fd, 'w')
fh.write(str(key))
@ -155,7 +155,7 @@ def key_for_hostname(hostname):
return key
def encrypt(key, msg):
return key.Encrypt(msg)
return key.Encrypt(msg.encode('utf-8'))
def decrypt(key, msg):
try: