javax.crypto.spec
public class SecretKeySpec extends Object implements KeySpec, SecretKey
Since this class implements {@link javax.crypto.SecretKey}, which
in turn extends {@link java.security.Key}, so instances of this class
may be passed directly to the init() methods of {@link
javax.crypto.Cipher}.
See Also: SecretKey SecretKeyFactory
| Constructor Summary | |
|---|---|
| SecretKeySpec(byte[] key, String algorithm)
Create a new secret key spec from an entire byte array.
| |
| SecretKeySpec(byte[] key, int off, int len, String algorithm)
Create a new secret key spec from part of a byte array.
| |
| Method Summary | |
|---|---|
| boolean | equals(Object o) |
| String | getAlgorithm()
Return the name of the algorithm associated with this secret key.
|
| byte[] | getEncoded()
Return the key as a byte array.
|
| String | getFormat()
This key's format, which is always "RAW".
|
| int | hashCode() |
Parameters: key The key material. algorithm The name of the algorithm using this key.
Parameters: key The key material. off The offset at which key material begins. len The length of key material. algorithm The name of the algorithm using this key.
Returns: The algorithm's name.
Returns: The key material.
Returns: "RAW"