Package org.bouncycastle.bcpg

## Class RSASecretBCPGKey

- java.lang.Object
- - org.bouncycastle.bcpg.BCPGObject
  - - org.bouncycastle.bcpg.RSASecretBCPGKey

- All Implemented Interfaces:
    `BCPGKey`, `org.bouncycastle.util.Encodable`

      public class RSASecretBCPGKey
      extends BCPGObject
      implements BCPGKey

  base class for an RSA Secret (or Private) Key.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `RSASecretBCPGKey​(java.math.BigInteger d, java.math.BigInteger p, java.math.BigInteger q)` |
    `RSASecretBCPGKey​(BCPGInputStream in)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `encode​(BCPGOutputStream out)` |
    `java.math.BigInteger` | `getCrtCoefficient()` | return the crt coefficient
    `byte[]` | `getEncoded()` | return the standard PGP encoding of the key.
    `java.lang.String` | `getFormat()` | return "PGP"
    `java.math.BigInteger` | `getModulus()` | return the modulus for this key.
    `java.math.BigInteger` | `getPrimeExponentP()` | return the prime exponent of p
    `java.math.BigInteger` | `getPrimeExponentQ()` | return the prime exponent of q
    `java.math.BigInteger` | `getPrimeP()` | return the prime P
    `java.math.BigInteger` | `getPrimeQ()` | return the prime Q
    `java.math.BigInteger` | `getPrivateExponent()` | return the private exponent for this key.

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

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

- - ### Constructor Detail

    - #### RSASecretBCPGKey

          public RSASecretBCPGKey​(BCPGInputStream in)
                           throws java.io.IOException

      Parameters:
        `in` -
      Throws:
        `java.io.IOException`

    - #### RSASecretBCPGKey

          public RSASecretBCPGKey​(java.math.BigInteger d,
                                  java.math.BigInteger p,
                                  java.math.BigInteger q)

      Parameters:
        `d` -
        `p` -
        `q` -

  - ### Method Detail

    - #### getModulus

          public java.math.BigInteger getModulus()

      return the modulus for this key.
      Returns:
        BigInteger

    - #### getPrivateExponent

          public java.math.BigInteger getPrivateExponent()

      return the private exponent for this key.
      Returns:
        BigInteger

    - #### getPrimeP

          public java.math.BigInteger getPrimeP()

      return the prime P

    - #### getPrimeQ

          public java.math.BigInteger getPrimeQ()

      return the prime Q

    - #### getPrimeExponentP

          public java.math.BigInteger getPrimeExponentP()

      return the prime exponent of p

    - #### getPrimeExponentQ

          public java.math.BigInteger getPrimeExponentQ()

      return the prime exponent of q

    - #### getCrtCoefficient

          public java.math.BigInteger getCrtCoefficient()

      return the crt coefficient

    - #### getFormat

          public java.lang.String getFormat()

      return "PGP"
      Specified by:
        `getFormat` in interface `BCPGKey`
      Returns:
        "RAW" or "PGP"
      See Also:
        `BCPGKey.getFormat()`

    - #### getEncoded

          public byte[] getEncoded()

      return the standard PGP encoding of the key.
      Specified by:
        `getEncoded` in interface `BCPGKey`
      Specified by:
        `getEncoded` in interface `org.bouncycastle.util.Encodable`
      Overrides:
        `getEncoded` in class `BCPGObject`
      Returns:
        byte[]
      See Also:
        `BCPGKey.getEncoded()`

    - #### encode

          public void encode​(BCPGOutputStream out)
                      throws java.io.IOException

      Specified by:
        `encode` in class `BCPGObject`
      Throws:
        `java.io.IOException`