I have a question regarding the headings in cryptography. In python, in the pycryptodome module, I am doing symmetric encryption, which asks for a header that goes as follows:

Cipher = Crypto.Chiper.AES.new(key)

My question is, how do I configure the header correctly? I've seen examples of just putting a str, like , and never explaining beyond what they are for, because I should use them, how I should use them, etc. If I need to know how to use them correctly, because I should use them, I understand that they are associated data that are linked or related to the content to be encrypted.


What associated data (or encrypted header in the plaintext message) to use is dependent on the protocol, not on the cryptographic algorithm.

Generally, for messages in a transport protocol, you'd use the to avoid replay attacks.

The header data may also contain other meta-data that you want to authenticate for the message.

Beyond that, there is nothing to tell you, because you've only listed a (partial) algorithm, and not the protocol.

| improve this answer | |
  • $\begingroup$ Tell me from the protocol point of view. That an attacker cannot get the message header and duplicator, or how does it guarantee that security? $\endgroup$ – retr0 Feb 13 at 19:44
  • 2
    $\begingroup$ If it is in the associated data then the attacker 1. needs to know it (it might not be transmitted at all!) and 2. the attacker cannot change it if it is send without invalidating the ciphertext and thus message. Your comment is rather unclear, but I hope this answers it. $\endgroup$ – Maarten Bodewes Feb 13 at 20:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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