Node:The IKeyPairCodec Interface, Next:, Previous:The KeyPairGeneratorFactory Class, Up:Keypairs



The IKeyPairCodec Interface

A key pair codec is used to externalize and de-externalize the key pairs used in GNU Crypto. There is no factory class, but rather the implementations have public, zero-argument constructors. The available codecs are:

int RAW_FORMAT Variable
Constant identifying the "raw" format used by GNU Crypto.

java.security.PrivateKey decodePrivateKey (byte[] encoded) Function
Decodes a private key from its external representation, returning it as an appropriate instance of java.security.PrivateKey. This function will throw a java.lang.IllegalArgumentException if the encoded bytes cannot be decoded or are incorrect.

java.security.PublicKey decodePublicKey (byte[] encoded) Function
Decodes a public key from its external representation, returning it as an appropriate instance of java.security.PublicKey. This function will throw a java.lang.IllegalArgumentException if the encoded bytes cannot be decoded or are incorrect.

byte [] encodePrivateKey (java.security.PrivateKey key) Function
Encodes a private key to its external representation, returning the encoded bytes. This function will throw a java.lang.IllegalArgumentException if the key cannot be encoded by this instance.

byte [] encodePublicKey (java.security.PublicKey key) Function
Encodes a public key to its external representation, returning the encoded bytes. This function will throw a java.lang.IllegalArgumentException if the key cannot be encoded by this instance.

int getFormatID () Function
Returns the format identifier of this codec, such as RAW_FORMAT.