javascript - Encryption: What is a tag? -
i reading through node-forge documentation , keep seeing reference 'tag' variable. tag , meant for?
in examples given, they're using aes in galois/counter mode (gcm). gcm provides both confidentiality (similar ctr mode), , message integrity (similar if using hmac in addition aes).
the tag authentication tag. it's computed each block of ciphertext, , used verify no 1 has tampered data.
you can see these lines here:
var pass = decipher.finish(); // pass false if there failure (eg: authentication tag didn't match) if (pass) { // outputs decrypted hex console.log(decipher.output.tohex()); }
where check made see if authentication tag validated correctly.
Comments
Post a Comment