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

Quick Search    Search Deep

gnu.java.security.key.dss
Class DSSKeyPairPKCS8Codec  view DSSKeyPairPKCS8Codec download DSSKeyPairPKCS8Codec.java

java.lang.Object
  extended bygnu.java.security.key.dss.DSSKeyPairPKCS8Codec
All Implemented Interfaces:
gnu.java.security.key.IKeyPairCodec

public class DSSKeyPairPKCS8Codec
extends java.lang.Object
implements gnu.java.security.key.IKeyPairCodec

An implementation of an gnu.java.security.key.IKeyPairCodec that knows how to encode / decode PKCS#8 ASN.1 external representation of DSS private keys.


Field Summary
private static gnu.java.security.OID DSA_ALG_OID
           
private static java.util.logging.Logger log
           
 
Fields inherited from interface gnu.java.security.key.IKeyPairCodec
ASN1_FORMAT, PKCS8_FORMAT, RAW_FORMAT, X509_FORMAT
 
Constructor Summary
DSSKeyPairPKCS8Codec()
           
 
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)
          Returns the PKCS#8 ASN.1 PrivateKeyInfo representation of a DSA private key.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final java.util.logging.Logger log

DSA_ALG_OID

private static final gnu.java.security.OID DSA_ALG_OID
Constructor Detail

DSSKeyPairPKCS8Codec

public DSSKeyPairPKCS8Codec()
Method Detail

getFormatID

public int getFormatID()
Description copied from interface: gnu.java.security.key.IKeyPairCodec

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

Specified by:
getFormatID in interface gnu.java.security.key.IKeyPairCodec

encodePublicKey

public byte[] encodePublicKey(java.security.PublicKey key)
Description copied from interface: gnu.java.security.key.IKeyPairCodec

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

Specified by:
encodePublicKey in interface gnu.java.security.key.IKeyPairCodec

encodePrivateKey

public byte[] encodePrivateKey(java.security.PrivateKey key)
Returns the PKCS#8 ASN.1 PrivateKeyInfo representation of a DSA private key. The ASN.1 specification is as follows:
   PrivateKeyInfo ::= SEQUENCE {
     version              INTEGER, -- MUST be 0
     privateKeyAlgorithm  AlgorithmIdentifier,
     privateKey           OCTET STRING
   }

   AlgorithmIdentifier ::= SEQUENCE {
     algorithm   OBJECT IDENTIFIER,
     parameters  ANY DEFINED BY algorithm OPTIONAL
   }

   DssParams ::= SEQUENCE {
     p   INTEGER,
     q   INTEGER,
     g   INTEGER
   }
 

Specified by:
encodePrivateKey in interface gnu.java.security.key.IKeyPairCodec

decodePublicKey

public java.security.PublicKey decodePublicKey(byte[] input)
Description copied from interface: gnu.java.security.key.IKeyPairCodec

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

Specified by:
decodePublicKey in interface gnu.java.security.key.IKeyPairCodec

decodePrivateKey

public java.security.PrivateKey decodePrivateKey(byte[] input)
Description copied from interface: gnu.java.security.key.IKeyPairCodec

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

Specified by:
decodePrivateKey in interface gnu.java.security.key.IKeyPairCodec