Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

gnu.java.security.key
Interface IKeyPairCodec  view IKeyPairCodec download IKeyPairCodec.java


public interface IKeyPairCodec

The visible methods of an object that knows how to encode and decode cryptographic asymmetric keypairs. Codecs are useful for (a) externalising public and private keys for storage and on-the-wire transmission, as well as (b) re-creating their internal Java representation from external sources.


Field Summary
static int ASN1_FORMAT
          Constant identifying the ASN.1 encoding format: a combined encoding of X.509 for public keys, and PKCS#8 for private ones.
static int PKCS8_FORMAT
          Constant identifying the PKCS#8 encoding format.
static int RAW_FORMAT
          Constant identifying the Raw encoding format.
static int X509_FORMAT
          Constant identifying the X.509 encoding format.
 
Method Summary
 java.security.PrivateKey decodePrivateKey(byte[] input)
          Decodes an instance of an external private key into its native Java representation.
 java.security.PublicKey decodePublicKey(byte[] input)
          Decodes an instance of an external public key into its native Java representation.
 byte[] encodePrivateKey(java.security.PrivateKey key)
          Encodes an instance of a private key for storage or transmission purposes.
 byte[] encodePublicKey(java.security.PublicKey key)
          Encodes an instance of a public key for storage or transmission purposes.
 int getFormatID()
          Returns the unique identifier (within this library) of the format used to externalise public and private keys.
 

Field Detail

RAW_FORMAT

public static final int RAW_FORMAT
Constant identifying the Raw encoding format.

See Also:
Constant Field Values

X509_FORMAT

public static final int X509_FORMAT
Constant identifying the X.509 encoding format.

See Also:
Constant Field Values

PKCS8_FORMAT

public static final int PKCS8_FORMAT
Constant identifying the PKCS#8 encoding format.

See Also:
Constant Field Values

ASN1_FORMAT

public static final int ASN1_FORMAT
Constant identifying the ASN.1 encoding format: a combined encoding of X.509 for public keys, and PKCS#8 for private ones.

See Also:
Constant Field Values
Method Detail

getFormatID

public int getFormatID()

Returns the unique identifier (within this library) of the format used to externalise public and private keys.


encodePublicKey

public byte[] encodePublicKey(java.security.PublicKey key)

Encodes an instance of a public key for storage or transmission purposes.


encodePrivateKey

public byte[] encodePrivateKey(java.security.PrivateKey key)

Encodes an instance of a private key for storage or transmission purposes.


decodePublicKey

public java.security.PublicKey decodePublicKey(byte[] input)

Decodes an instance of an external public key into its native Java representation.


decodePrivateKey

public java.security.PrivateKey decodePrivateKey(byte[] input)

Decodes an instance of an external private key into its native Java representation.