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:
gnu.crypto.key.dh.DHKeyPairRawCodec
, for encoding and decoding
Diffie-Hellman key pairs.
gnu.crypto.key.dss.DSSKeyPairRawCodec
, for encoding and decoding
DSS key pairs.
gnu.crypto.key.rsa.RSAKeyPairRawCodec
, for encoding and decoding
RSA key pairs.
gnu.crypto.key.srp6.SRPKeyPairRawCodec
, for encoding and decoding
SRP key pairs.
Decodes a private key from its external representation, returning it as an appropriate instance of
java.security.PrivateKey
. This function will throw ajava.lang.IllegalArgumentException
if the encoded bytes cannot be decoded or are incorrect.
Decodes a public key from its external representation, returning it as an appropriate instance of
java.security.PublicKey
. This function will throw ajava.lang.IllegalArgumentException
if the encoded bytes cannot be decoded or are incorrect.
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.