RSAPrivateKey (Bouncy Castle Library 1.52 API Specification)

org.bouncycastle.asn1.pkcs

## Class RSAPrivateKey

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

- All Implemented Interfaces:
    ASN1Encodable, Encodable

      public class RSAPrivateKey
      extends ASN1Object

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `RSAPrivateKey(java.math.BigInteger modulus, java.math.BigInteger publicExponent, java.math.BigInteger privateExponent, java.math.BigInteger prime1, java.math.BigInteger prime2, java.math.BigInteger exponent1, java.math.BigInteger exponent2, java.math.BigInteger coefficient)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.math.BigInteger` | `getCoefficient()`
    `java.math.BigInteger` | `getExponent1()`
    `java.math.BigInteger` | `getExponent2()`
    `static RSAPrivateKey` | `getInstance(ASN1TaggedObject obj, boolean explicit)`
    `static RSAPrivateKey` | `getInstance(java.lang.Object obj)`
    `java.math.BigInteger` | `getModulus()`
    `java.math.BigInteger` | `getPrime1()`
    `java.math.BigInteger` | `getPrime2()`
    `java.math.BigInteger` | `getPrivateExponent()`
    `java.math.BigInteger` | `getPublicExponent()`
    `java.math.BigInteger` | `getVersion()`
    `ASN1Primitive` | `toASN1Primitive()` This outputs the key in PKCS1v2 format.

    - ### 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

    - #### RSAPrivateKey

          public RSAPrivateKey(java.math.BigInteger modulus,
                       java.math.BigInteger publicExponent,
                       java.math.BigInteger privateExponent,
                       java.math.BigInteger prime1,
                       java.math.BigInteger prime2,
                       java.math.BigInteger exponent1,
                       java.math.BigInteger exponent2,
                       java.math.BigInteger coefficient)

  - ### Method Detail

    - #### getInstance

          public static RSAPrivateKey getInstance(ASN1TaggedObject obj,
                                  boolean explicit)

    - #### getInstance

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

    - #### getVersion

          public java.math.BigInteger getVersion()

    - #### getModulus

          public java.math.BigInteger getModulus()

    - #### getPublicExponent

          public java.math.BigInteger getPublicExponent()

    - #### getPrivateExponent

          public java.math.BigInteger getPrivateExponent()

    - #### getPrime1

          public java.math.BigInteger getPrime1()

    - #### getPrime2

          public java.math.BigInteger getPrime2()

    - #### getExponent1

          public java.math.BigInteger getExponent1()

    - #### getExponent2

          public java.math.BigInteger getExponent2()

    - #### getCoefficient

          public java.math.BigInteger getCoefficient()

    - #### toASN1Primitive

          public ASN1Primitive toASN1Primitive()

      This outputs the key in PKCS1v2 format.

                RSAPrivateKey ::= SEQUENCE {
                                    version Version,
                                    modulus INTEGER, -- n
                                    publicExponent INTEGER, -- e
                                    privateExponent INTEGER, -- d
                                    prime1 INTEGER, -- p
                                    prime2 INTEGER, -- q
                                    exponent1 INTEGER, -- d mod (p-1)
                                    exponent2 INTEGER, -- d mod (q-1)
                                    coefficient INTEGER, -- (inverse of q) mod p
                                    otherPrimeInfos OtherPrimeInfos OPTIONAL
                                }

                Version ::= INTEGER { two-prime(0), multi(1) }
                  (CONSTRAINED BY {-- version must be multi if otherPrimeInfos present --})

      This routine is written to output PKCS1 version 2.1, private keys.

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