cryptography - Java - Difference between javax.crypto.Mac and javax.crypto.Cipher? -
i understand difference between javax.crypto.mac , javax.crypto.cipher. 2 classes looks similar (they have similar methods 2 classes not inherits each another).
- what's fundamental difference between 2 classes ?
- when should use (or not use) mac ?
- when should use (or not use) cipher ?
a message authentication code integrity. computes, on input message, kind of "keyed checksum" depends on message , on key. knowledge of key, mac can verified match given message. alterations reliably detected.
a symmetric encryption algorithm confidentiality. transforms message unreadable sequence of bits; encryption reversible provided decryption key known.
mac not ensure confidentiality; message kept is, plainly readable. encryption not ensure integrity; alterations may go undetected. in applied cryptography, need both. (but mind "properly" term big.)
Comments
Post a Comment