Cryptography Tutorials - Herong's Tutorial Examples - v5.40, by Dr. Herong Yang
javax.crypto.SecretKey - The Secret Key Interface
This section provides a quick introduction of secret key and symmetric encryption algorithm. The secret key interface, javax.crypto.SecretKey, is also described.
What is a Secret Key? A secrete key is the key used in a symmetric encryption algorithm, where the same key is used both the encryption process and the decryption process.
Known symmetric encryption algorithms:
The secrect key concept is supported in JDK through the JCE (Java Cryptography Extension) package. The first thing I want to learn in JCE is the javax.crypto.SecretKey interface.
javax.crypto.SecretKey is an interface providing a grouping point for various secret keys. It extents java.security.Key, and inherits 3 methods:
getAlgorithm() - Returns the algorithm name used to generate the key.
getEncoded() - Returns the key as a byte array in its primary encoding format.
getFormat() - Returns the name of the primary encoding format of this key.
Table of Contents