AES-256 and HMAC
This is a reminder on how to apply HMAC over the AES encrypted data for integrity:
ciphertext = iv + aes(key, iv, plaintext)
tag = hmac(hmac_key, ciphertext, sha256)
The key lengths are important too:
key = os.urandom(256/8) # AES-256 key size
iv = os.urandom(128/8) # AES block size
hmac_key = os.urandom(512/8) # SHA-256 block size
Comments are welcome.
Written by Paul Eipper
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Python
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#