PrivateKeyInfo (Bouncy Castle Library 1.52 API Specification)
Date: 2015-03-01

org.bouncycastle.asn1.pkcs

## Class PrivateKeyInfo

- java.lang.Object
- - org.bouncycastle.asn1.ASN1Object
  - - org.bouncycastle.asn1.pkcs.PrivateKeyInfo

- All Implemented Interfaces:
    ASN1Encodable, Encodable

      public class PrivateKeyInfo
      extends ASN1Object

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `PrivateKeyInfo(AlgorithmIdentifier algId, ASN1Encodable privateKey)`
    `PrivateKeyInfo(AlgorithmIdentifier algId, ASN1Encodable privateKey, ASN1Set attributes)`
    `PrivateKeyInfo(ASN1Sequence seq)` Deprecated. use PrivateKeyInfo.getInstance()

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `AlgorithmIdentifier` | `getAlgorithmId()` Deprecated. use getPrivateKeyAlgorithm()
    `ASN1Set` | `getAttributes()`
    `static PrivateKeyInfo` | `getInstance(ASN1TaggedObject obj, boolean explicit)`
    `static PrivateKeyInfo` | `getInstance(java.lang.Object obj)`
    `ASN1Primitive` | `getPrivateKey()` Deprecated. use parsePrivateKey()
    `AlgorithmIdentifier` | `getPrivateKeyAlgorithm()`
    `ASN1Encodable` | `parsePrivateKey()`
    `ASN1Primitive` | `toASN1Primitive()` write out an RSA private key with its associated information as described in PKCS8.

    - ### Methods inherited from class org.bouncycastle.asn1.ASN1Object

      `equals, getEncoded, getEncoded, hasEncodedTagValue, hashCode, toASN1Object`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### PrivateKeyInfo

          public PrivateKeyInfo(AlgorithmIdentifier algId,
                        ASN1Encodable privateKey)
                         throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### PrivateKeyInfo

          public PrivateKeyInfo(AlgorithmIdentifier algId,
                        ASN1Encodable privateKey,
                        ASN1Set attributes)
                         throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### PrivateKeyInfo

          public PrivateKeyInfo(ASN1Sequence seq)

      Deprecated. use PrivateKeyInfo.getInstance()
      Parameters:
        `seq` -

  - ### Method Detail

    - #### getInstance

          public static PrivateKeyInfo getInstance(ASN1TaggedObject obj,
                                   boolean explicit)

    - #### getInstance

          public static PrivateKeyInfo getInstance(java.lang.Object obj)

    - #### getPrivateKeyAlgorithm

          public AlgorithmIdentifier getPrivateKeyAlgorithm()

    - #### getAlgorithmId

          public AlgorithmIdentifier getAlgorithmId()

      Deprecated. use getPrivateKeyAlgorithm()

    - #### parsePrivateKey

          public ASN1Encodable parsePrivateKey()
                                        throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### getPrivateKey

          public ASN1Primitive getPrivateKey()

      Deprecated. use parsePrivateKey()

    - #### getAttributes

          public ASN1Set getAttributes()

    - #### toASN1Primitive

          public ASN1Primitive toASN1Primitive()

      write out an RSA private key with its associated information as described in PKCS8.

                PrivateKeyInfo ::= SEQUENCE {
                                        version Version,
                                        privateKeyAlgorithm AlgorithmIdentifier {{PrivateKeyAlgorithms}},
                                        privateKey PrivateKey,
                                        attributes [0] IMPLICIT Attributes OPTIONAL
                                    }
                Version ::= INTEGER {v1(0)} (v1,...)

                PrivateKey ::= OCTET STRING

                Attributes ::= SET OF Attribute

      Specified by:
        `toASN1Primitive` in interface `ASN1Encodable`
      Specified by:
        `toASN1Primitive` in class `ASN1Object`
      Returns:
        a primitive representation of this object.