java.security.spec
Class PKCS8EncodedKeySpec

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.security.spec.EncodedKeySpec sample code for java.security.spec.EncodedKeySpec definition code for java.security.spec.EncodedKeySpec 
      extended by java.security.spec.PKCS8EncodedKeySpec
All Implemented Interfaces:
KeySpec sample code for java.security.spec.KeySpec definition code for java.security.spec.KeySpec

public class PKCS8EncodedKeySpec
extends EncodedKeySpec sample code for java.security.spec.EncodedKeySpec definition code for java.security.spec.EncodedKeySpec

This class represents the ASN.1 encoding of a private key, encoded according to the ASN.1 type PrivateKeyInfo. The PrivateKeyInfo syntax is defined in the PKCS#8 standard as follows:

 PrivateKeyInfo ::= SEQUENCE {
   version Version,
   privateKeyAlgorithm PrivateKeyAlgorithmIdentifier,
   privateKey PrivateKey,
   attributes [0] IMPLICIT Attributes OPTIONAL }

 Version ::= INTEGER

 PrivateKeyAlgorithmIdentifier ::= AlgorithmIdentifier

 PrivateKey ::= OCTET STRING

 Attributes ::= SET OF Attribute
 

Since:
1.2
See Also:
Key sample code for java.security.Key definition code for java.security.Key , KeyFactory sample code for java.security.KeyFactory definition code for java.security.KeyFactory , KeySpec sample code for java.security.spec.KeySpec definition code for java.security.spec.KeySpec , EncodedKeySpec sample code for java.security.spec.EncodedKeySpec definition code for java.security.spec.EncodedKeySpec , X509EncodedKeySpec sample code for java.security.spec.X509EncodedKeySpec definition code for java.security.spec.X509EncodedKeySpec

Constructor Summary
PKCS8EncodedKeySpec sample code for java.security.spec.PKCS8EncodedKeySpec.PKCS8EncodedKeySpec(byte[]) definition code for java.security.spec.PKCS8EncodedKeySpec.PKCS8EncodedKeySpec(byte[]) (byte[] encodedKey)
          Creates a new PKCS8EncodedKeySpec with the given encoded key.
 
Method Summary
 byte[] getEncoded sample code for java.security.spec.PKCS8EncodedKeySpec.getEncoded() definition code for java.security.spec.PKCS8EncodedKeySpec.getEncoded() ()
          Returns the key bytes, encoded according to the PKCS #8 standard.
 String sample code for java.lang.String definition code for java.lang.String getFormat sample code for java.security.spec.PKCS8EncodedKeySpec.getFormat() definition code for java.security.spec.PKCS8EncodedKeySpec.getFormat() ()
          Returns the name of the encoding format associated with this key specification.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

PKCS8EncodedKeySpec sample code for java.security.spec.PKCS8EncodedKeySpec(byte[]) definition code for java.security.spec.PKCS8EncodedKeySpec(byte[])

public PKCS8EncodedKeySpec(byte[] encodedKey)
Creates a new PKCS8EncodedKeySpec with the given encoded key.

Parameters:
encodedKey - the key, which is assumed to be encoded according to the PKCS #8 standard. The contents of the array are copied to protect against subsequent modification.
Method Detail

getEncoded sample code for java.security.spec.PKCS8EncodedKeySpec.getEncoded() definition code for java.security.spec.PKCS8EncodedKeySpec.getEncoded()

public byte[] getEncoded()
Returns the key bytes, encoded according to the PKCS #8 standard.

Overrides:
getEncoded sample code for java.security.spec.EncodedKeySpec.getEncoded() definition code for java.security.spec.EncodedKeySpec.getEncoded() in class EncodedKeySpec sample code for java.security.spec.EncodedKeySpec definition code for java.security.spec.EncodedKeySpec
Returns:
the PKCS #8 encoding of the key. Returns a new array each time this method is called.

getFormat sample code for java.security.spec.PKCS8EncodedKeySpec.getFormat() definition code for java.security.spec.PKCS8EncodedKeySpec.getFormat()

public final String sample code for java.lang.String definition code for java.lang.String  getFormat()
Returns the name of the encoding format associated with this key specification.

Specified by:
getFormat sample code for java.security.spec.EncodedKeySpec.getFormat() definition code for java.security.spec.EncodedKeySpec.getFormat() in class EncodedKeySpec sample code for java.security.spec.EncodedKeySpec definition code for java.security.spec.EncodedKeySpec
Returns:
the string "PKCS#8".