Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to extract Authentication Tag from ciphertext? #43

Open
AlexMesser opened this issue Dec 11, 2020 · 0 comments
Open

How to extract Authentication Tag from ciphertext? #43

AlexMesser opened this issue Dec 11, 2020 · 0 comments

Comments

@AlexMesser
Copy link

I need to build a proper JWE using crypto_aead_xchacha20poly1305_ietf_encrypt function as AEAD construction.

The official libsodium documentation says that "In combined mode, the authentication tag is directly appended to the encrypted message" but it is not clear for me how to extract this tag from ciphertext to use it as tag property of JWE.

There is another function in libsodium called crypto_aead_xchacha20poly1305_ietf_encrypt_detached which returns authentication tag separately, but it is not implemented in sodium-plus.

I have two workaround ideas:

  • use crypto_auth function to compute auth tag from ciphertext and crypto_auth_verify to verify it
  • slice some bytes from M to N from ciphertext to get the tag, but I don't know the M and N

so, how to obtain authentication tag?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant