java.security
Interface Key
java.lang.Object
|
+--java.io.Serializable
|
+--java.security.Key
All Implemented Interfaces:
Serializable
This interfaces models the base characteristics that all keys must
have. These are: a key algorithm, an encoded form, and a format used
to encode the key. Specific key types inherit from this interface.
Note that since this interface extends Serializable
, all
keys may be serialized. Keys are generally obtained through key generators,
including KeyFactory.
Since:Author:- Aaron M. Renn <arenn@urbanophile.com>
See Also:
getAlgorithm
public String getAlgorithm()
This method returns the name of the algorithm for this key. This is a
String
such as "RSA".
Returns:
- the name of the algorithm in use
getEncoded
public byte[] getEncoded()
This method returns the encoded form of the key. If this key does not
support encoding, this method returns null
.
Returns:
- the encoded form of the key, or null
getFormat
public String getFormat()
This method returns the name of the encoding format for this key. This
is the name of the ASN.1 data format used for this key, such as
"X.509" or "PKCS#8". This method returns null
if this key
does not have an encoding format.
Returns:
- the name of the encoding format for this key, or null
Serializable
, all keys may be serialized. Keys are generally obtained through key generators, including KeyFactory.