Overview | Package | Class | Tree | Deprecated | Index | Help
| For the latest news and information visit The GNU Crypto project
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## gnu.crypto.sig
Interface IKeyPairCodec

All Known Implementing Classes:
  DSSKeyPairRawCodec, RSAKeyPairRawCodec

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.

Version:
  $Revision: 1.2 $

Field Summary
`static int` | `RAW_FORMAT` Constant identifying the Raw 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 format.

Method Detail

### getFormatID

    public int getFormatID()

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

  Returns:
    the identifier of the format, the object supports.

### encodePublicKey

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

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

  Parameters:
    `key` - the non-null key to encode.
  Returns:
    a byte sequence representing the encoding of the designated key according to the format supported by this codec.
  Throws:
    `java.lang.IllegalArgumentException` - if the designated key is not supported by this codec.

### encodePrivateKey

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

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

  Parameters:
    `key` - the non-null key to encode.
  Returns:
    a byte sequence representing the encoding of the designated key according to the format supported by this codec.
  Throws:
    `java.lang.IllegalArgumentException` - if the designated key is not supported by this codec.

### decodePublicKey

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

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

  Parameters:
    `input` - the source of the externalised key to decode.
  Returns:
    a concrete instance of a public key, reconstructed from the designated input.
  Throws:
    `java.lang.IllegalArgumentException` - if the designated input does not contain a known representation of a public key for the format supported by the concrete codec.

### decodePrivateKey

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

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

  Parameters:
    `input` - the source of the externalised key to decode.
  Returns:
    a concrete instance of a private key, reconstructed from the designated input.
  Throws:
    `java.lang.IllegalArgumentException` - if the designated input does not contain a known representation of a private key for the format supported by the concrete codec.

Overview | Package | Class | Tree | Deprecated | Index | Help
| For the latest news and information visit The GNU Crypto project
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright ©2001-2002 Free Software Foundation, Inc.. All Rights Reserved.