|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.crypto.spec.SecretKeySpec
Secret key specification.
Attention: This is not a SUN implementation!
This class has been developed by IAIK according to the documentation publicly
available.
For SUNīs documentation of this class see
http://java.sun.com/security/JCE1.2/spec/apidoc/index.html
This class represents a provider-independent Secret key specification.
A key specification is a transparent representation of the key material constituting the key. To, for instance, specifiy a DES key in provider independent manner, supply the key bytes and request a secret key specification for the DES algorithm, e.g.:
byte[] keyBytes = ...; SecretKeySpec secKeySpec = new SecretKeySpec(keyBytes, "DES");
This class does not check if the supplied key material actually will constitute a secret key of type matching to the requested algorithm. For ensuring this, an algorithm-dependent key specification has to be used, e.g.:
byte[] keyBytes = ...; DESKeySpec desKeySpec = new DESKeySpec(keyBytes);
DESKeySpec
,
DESedeKeySpec
, Serialized FormFields inherited from interface java.security.Key |
serialVersionUID |
Constructor Summary | |
SecretKeySpec(byte[] key,
int offset,
int len,
String algorithm)
Creates a secret key specification for the requested algorithm from the given number of bytes of the supplied byte array, beginning at the given offset. |
|
SecretKeySpec(byte[] key,
String algorithm)
Creates a secret key specification for the requested algorithm from the given byte array. |
Method Summary | |
boolean |
equals(Object obj)
Compares two SecretKeySpecs. |
String |
getAlgorithm()
Returns the name of the algorithm associated with this secret key. |
byte[] |
getEncoded()
Returns the key material constituting this secret key. |
String |
getFormat()
Returns the name of the encoding format for this secret key. |
int |
hashCode()
Returns a hash code value for this object. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SecretKeySpec(byte[] key, String algorithm)
This constructor does not check if the supplied key material actually will constitute a secret key of type matching to the requested algorithm. For ensuring this, an algorithm-dependent key specification has to be created, e.g.:
byte[] keyBytes = ...; DESKeySpec desKeySpec = new DESKeySpec(keyBytes);
key
- the key material constituting the secret keyalgorithm
- the name of the algorithm for which the secret key
shall be createdpublic SecretKeySpec(byte[] key, int offset, int len, String algorithm)
This constructor does not check if the supplied key material actually will constitute a secret key of type matching to the requested algorithm. For ensuring this, an algorithm-dependent key specification has to be created, e.g.:
byte[] keyBytes = ...; DESKeySpec desKeySpec = new DESKeySpec(keyBytes, off_set);
key
- the key material constituting the secret keyoffset
- the offset the offset indicating the start position
within the input key byte arraylen
- the length of the subarrayalgorithm
- the name of the algorithm for which the secret key
shall be createdMethod Detail |
public String getAlgorithm()
getAlgorithm
in interface Key
public String getFormat()
getFormat
in interface Key
public byte[] getEncoded()
getEncoded
in interface Key
public boolean equals(Object obj)
equals
in class Object
obj
- an object to be compared with this pointpublic int hashCode()
hashCode
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 |