Skip to content

Integer nonce incrementing and encoding for AEAD_Mode for Chacha20Poly1305 Vs AES-GCM #4466

Answered by reneme
nata11 asked this question in Q&A
Discussion options

You must be logged in to vote

I have a requirement to have integer nonce which will increment as a counter for each encryption.

Just to clarify: Is your requirement to increment your nonce on a per-block basis (i.e. 16 bytes/128 bits), or on a per-message basis (arbitrary data size)? The latter sounds like a really bad idea, because it almost certainly leads to nonce-reuse and loss of confidentiality if you encrypt multiple messages under the same key.

The nonce increment on a per-block basis is just what AES-GCM does internally and you wouldn't need to worry about it when encrypting messages that are larger than 16 bytes.

it seems that the integer nonce will need to be converted/encoded to a std::vector<uint8_t>

T…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by nata11
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants