-2
$\begingroup$

I want to write a sniffer that can read AES-GCM communication using the gcrypt lib I can see in the manual that for encryption there is an additional 2 methods (for AEAD) but what about decryption ? what need to do for decryption for AEAD ciphers ? Thanks Lior

$\endgroup$
  • 2
    $\begingroup$ Encryption and decryption is the same for GCM (as it uses CTR for encryption) $\endgroup$ – LightBit Dec 1 '15 at 8:56
  • 2
    $\begingroup$ Are you asking how to do it with gcrypt? That's off topic here and could be asked on Stack Exchange. $\endgroup$ – otus Dec 1 '15 at 9:02
  • 1
    $\begingroup$ @otus, on "Stack Exchange" is a bit misleading. I guess you meant StackOverflow. $\endgroup$ – SEJPM Dec 1 '15 at 19:59
  • $\begingroup$ @SEJPM, yes, typo/brainfart. $\endgroup$ – otus Dec 1 '15 at 20:13
  • $\begingroup$ I see at least three methods specifically for AEAD...getting the tag, checking the tag and indicating additional authenticated data. $\endgroup$ – Maarten Bodewes Dec 2 '15 at 0:59
1
$\begingroup$

You need to call gcry_cipher_authenticate if you have additional authenticated data (data also authenticated that is not encrypted and - in this case after decryption of the ciphertext, excluding authentication tag - you should call gcry_cipher_checktag with the authentication tag. It's wise and possibly required to call gcry_cipher_authenticate before decryption of any data.

You should not rely on the correctness of the decrypted data before verifying (checking) the authentication tag. Note that the handling of the authentication tag differs from one library to the other (and this library actually takes the sensible route if you ask me: fully online decryption and explicit tag verification).

$\endgroup$

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.