diff options
author | Frank Denis <github@pureftpd.org> | 2015-06-24 16:29:45 +0200 |
---|---|---|
committer | Frank Denis <github@pureftpd.org> | 2015-06-24 16:56:57 +0200 |
commit | 34d688ca72d8ef13b83987cc3b3d9b93ab989d9f (patch) | |
tree | 0bb44d5e4ef275665060357b61afed2db4c93852 /api/templates/reset_subject.html | |
parent | 5bc0a19953a4c66058da08e7d560a01b0d428607 (diff) | |
download | chat-34d688ca72d8ef13b83987cc3b3d9b93ab989d9f.tar.gz chat-34d688ca72d8ef13b83987cc3b3d9b93ab989d9f.tar.bz2 chat-34d688ca72d8ef13b83987cc3b3d9b93ab989d9f.zip |
SQL store: use authenticated encryption
Data were encrypted using AES-CFB, with a properly randomized IV,
but without any authenticators. This allows the data to be tampered
with, without being noticed by the application.
This diff slightly changes the encryption/decryption functions in
sql_store.go to add a HMAC-SHA256 authenticator to encrypted messages.
Two keys are derived from AtRestEncryptKey: the first half of
SHA512(AtRestEncryptKey) for the block cipher and the second half for
the MAC. This can be changed to a KDF if needed.
The decryption function also checks that base64 decoding actually
worked, and that the ciphertext is long enough to include the IV and
the MAC.
Unfortunately, it breaks backward compatibility. But if such a change
has to be made, it has to be made early.
Diffstat (limited to 'api/templates/reset_subject.html')
0 files changed, 0 insertions, 0 deletions