|
||||||||||
| 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 Form| Fields inherited from interface java.security.Key |
serialVersionUID |
| Constructor Summary | |
SecretKeySpec(byte[] key,
int offset,
int len,
java.lang.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,
java.lang.String algorithm)
Creates a secret key specification for the requested algorithm from the given byte array. |
|
| Method Summary | |
boolean |
equals(java.lang.Object obj)
Compares two SecretKeySpecs. |
java.lang.String |
getAlgorithm()
Returns the name of the algorithm associated with this secret key. |
byte[] |
getEncoded()
Returns the key material constituting this secret key. |
java.lang.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,
java.lang.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 created
public SecretKeySpec(byte[] key,
int offset,
int len,
java.lang.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 created| Method Detail |
public java.lang.String getAlgorithm()
public java.lang.String getFormat()
public byte[] getEncoded()
public boolean equals(java.lang.Object obj)
obj - an object to be compared with this pointpublic int hashCode()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||