Index (Frames) | Index (No Frames) | Package | Package Tree | Tree
java.security

Interface Key

java.lang.Object
|
+--java.io.Serializable
   |
   +--java.security.Key

All Implemented Interfaces:

Serializable


public interface Key

implements 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:See Also:

Method Summary

java.lang.StringgetAlgorithm()

This method returns the name of the algorithm for this key.
byte[]getEncoded()

This method returns the encoded form of the key.
java.lang.StringgetFormat()

This method returns the name of the encoding format for this key.

Method Details

getAlgorithm

public String getAlgorithm()

This method returns the name of the algorithm for this key. This is a String such as "RSA".

Returns:


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:


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: