|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.crypto.spec.SecretKeySpec | +--iaik.security.cipher.SecretKey
This class represents a secret key as used with symmetric algorithms. Applications generally shall use a proper KeyGenerator for generating the requested Secret Key.
SecretKey
,
Key
,
KeyGenerator
, Serialized FormFields inherited from interface java.security.Key |
serialVersionUID |
Constructor Summary | |
SecretKey(byte[] key,
int off,
int len,
String algName)
Creates a SecretKey object from given byte sub-array and algorithm name. |
|
SecretKey(byte[] key,
String algName)
Creates a SecretKey object from given byte array and algorithm name. |
|
SecretKey(SecretKey key)
|
Method Summary | |
void |
destroyCriticalData()
Destroys the critical data of this object. |
boolean |
equals(Object obj)
Compares two secret keys. |
String |
getAlgorithm()
Returns the name of the key algorithm for this key. |
byte[] |
getEncoded()
Returns a copy of the secret key as byte array. |
String |
getFormat()
Returns the format name. |
int |
hashCode()
Returns a hash code value for this object. |
void |
setAlgorithm(String algorithm)
Sets the algorithm name of this secret key. |
String |
toString()
Returns a string representation of this SecretKey. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public SecretKey(byte[] key, String algName)
This constructor is called from inside a KeyGenerator to create a SecretKey.
Applications shall use the KeyGenerator.getInstance
and generateKey
methods for creating a SecretKey object.
key
- the key as byte arrayalgName
- the name of the key algorithmKeyGenerator.getInstance(java.lang.String)
,
KeyGenerator.generateKey()
public SecretKey(byte[] key, int off, int len, String algName)
off
, only len
bytes of the given key
byte array are used for creating the SecretKey.
This constructor is called from inside a KeyGenerator to create a SecretKey.
Applications shall use the KeyGenerator.getInstance
and generateKey
methods for creating a SecretKey object.
key
- the key as byte arrayalgName
- the name of the key algorithmKeyGenerator.getInstance(java.lang.String)
,
KeyGenerator.generateKey()
public SecretKey(SecretKey key) throws InvalidKeyException
Method Detail |
public byte[] getEncoded()
getEncoded
in class SecretKeySpec
public String getAlgorithm()
getAlgorithm
in class SecretKeySpec
public void setAlgorithm(String algorithm)
algorithm
- the name of the algorithm for this keypublic String getFormat()
getFormat
in class SecretKeySpec
public void destroyCriticalData()
public boolean equals(Object obj)
equals
in class SecretKeySpec
obj
- an object to be compared with this pointpublic int hashCode()
hashCode
in class SecretKeySpec
public String toString()
toString
in class Object
|
This Javadoc may contain text parts from Internet Standard specifications (RFC 2459, 3280, 3039, 2560, 1521, 821, 822, 2253, 1319, 1321, ,2630, 2631, 2268, 3058, 2984, 2104, 2144, 2040, 2311, 2279, see copyright note) and RSA Data Security Public-Key Cryptography Standards (PKCS#1,3,5,7,8,9,10,12, see copyright note). | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |