0
$\begingroup$

I've seen people everywhere say to use a MAC or HMAC with block ciphers. I think I understand the basics, but I'm still not sure how the HMAC secret is distributed so the other party can verify that it's valid. Is the secret distributed freely like the IV (though the name suggests it is secret)? Is it part of the ciphertext? Is it sent over a secure channel like the AES key?

Also, is it safe to use the same HMAC secret for each subsequent AES encrypted message after the initial connection? Assuming all keys (other than public/private keypairs) are destroyed after the connection is closed.

$\endgroup$

2 Answers 2

2
$\begingroup$

It is "sent over a secure channel like the AES key".
It is "safe to use the same HMAC secret for each subsequent
AES encrypted message after the initial connection".

$\endgroup$
1
$\begingroup$

How is the MAC or HMAC secret shared with the other party for verification?

It depends on the type of implementation or system you are interested in, but i can share my experience. Unless pre-agreed key is known before hand, usually a public key cryptography is used to share secret key (e.g. AES-key) over a public insecure channel.

  1. Encrypting by the public key of the receiver, you can enable the receiver to decrypt the key with its private key.
  2. Generating sharedsecret using public-private key of sender and receiver. You can refer Diffie-Hellman

is it safe to use the same HMAC secret for each subsequent AES encrypted message after the initial connection?

It depends what type of application you are planning. For example, if it is sensitive data requiring high security protection, you can generate shared key per session. You can refer Ephemeral Diffie-Hellman, that enables generating non static session key.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.