encryption - How to combine HMAC with AES for (python) client-server messenger? -
so trying write small encrypted command line im messenger accepts 2 keys args. not sure how 2 keys meant work or what. trying use hmac , aes unsure of how. please note educational purposes only, not intend try use anywhere else. having hard time understanding , advice or explanations appreciated. have working im messenger , running, need figure out hmac/aes/keys.
thank all, ~maddie
what should doing using encrypt-then-mac paradigm.
that means, first using first key encrypt message aes. afterwards, use second key authentication key hmac-sha256 function authenticate ciphertext (the output of encryption function). concatenate ciphertext , hmac output (called tag) , transmit on wire.
upon receiving such message recalulate tag ciphertext , compare 1 tranferred. if valid, may decrypt ciphertext.
final note: not need use seperate keys input parameter. if fine supply 1 master key , use derive seperate encryption- , authenctication-keys using key derivation function hkdf.
Comments
Post a Comment