Class Overview
A key specification for a SecretKey
and also a secret key
implementation that is provider-independent. It can be used for raw secret
keys that can be specified as byte[]
.
Summary
Public Constructors |
|
SecretKeySpec(byte[] key, String algorithm)
Creates a new SecretKeySpec for the specified key data and
algorithm name.
|
|
SecretKeySpec(byte[] key, int offset, int len, String algorithm)
Creates a new SecretKeySpec for the key data from the
specified buffer key starting at offset with
length len and the specified algorithm name.
|
Public Methods |
boolean
|
equals(Object obj)
Compares the specified object with this SecretKeySpec
instance.
|
String
|
getAlgorithm()
Returns the algorithm name.
|
byte[]
|
getEncoded()
Returns the encoded form of this secret key.
|
String
|
getFormat()
Returns the name of the format used to encode the key.
|
int
|
hashCode()
Returns the hash code of this SecretKeySpec object.
|
[Expand]
Inherited Methods |
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this Object .
|
boolean
|
equals(Object o)
Compares this instance with the specified object and indicates if they
are equal.
|
void
|
finalize()
Called before the object's memory is reclaimed by the VM.
|
final
Class<?>
|
getClass()
Returns the unique instance of Class that represents this
object's class.
|
int
|
hashCode()
Returns an integer hash code for this object.
|
final
void
|
notify()
Causes a thread which is waiting on this object's monitor (by means of
calling one of the wait() methods) to be woken up.
|
final
void
|
notifyAll()
Causes all threads which are waiting on this object's monitor (by means
of calling one of the wait() methods) to be woken up.
|
String
|
toString()
Returns a string containing a concise, human-readable description of this
object.
|
final
void
|
wait()
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.
|
final
void
|
wait(long millis, int nanos)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
specified timeout expires.
|
final
void
|
wait(long millis)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
specified timeout expires.
|
|
From interface
java.security.Key
abstract
String
|
getAlgorithm()
Returns the name of the algorithm of this key.
|
abstract
byte[]
|
getEncoded()
Returns the encoded form of this key, or null if encoding is not
supported by this key.
|
abstract
String
|
getFormat()
Returns the name of the format used to encode this key, or null
if it can not be encoded.
|
|
Public Constructors
public
SecretKeySpec
(byte[] key, String algorithm)
Creates a new SecretKeySpec
for the specified key data and
algorithm name.
Parameters
key
| the key data. |
algorithm
| the algorithm name. |
public
SecretKeySpec
(byte[] key, int offset, int len, String algorithm)
Creates a new SecretKeySpec
for the key data from the
specified buffer key
starting at offset
with
length len
and the specified algorithm
name.
Parameters
key
| the key data. |
offset
| the offset. |
len
| the size of the key data. |
algorithm
| the algorithm name. |
Public Methods
public
boolean
equals
(Object obj)
Compares the specified object with this SecretKeySpec
instance.
Parameters
obj
| the object to compare. |
Returns
- true if the algorithm name and key of both object are equal,
otherwise false.
public
String
getAlgorithm
()
Returns the algorithm name.
public
byte[]
getEncoded
()
Returns the encoded form of this secret key.
Returns
- the encoded form of this secret key.
public
String
getFormat
()
Returns the name of the format used to encode the key.
public
int
hashCode
()
Returns the hash code of this SecretKeySpec
object.