Package org.bouncycastle.pqc.jcajce.provider.rainbow

## Class BCRainbowPrivateKey

- java.lang.Object
- - org.bouncycastle.pqc.jcajce.provider.rainbow.BCRainbowPrivateKey

- All Implemented Interfaces:
    `java.io.Serializable`, `java.security.Key`, `java.security.PrivateKey`, `javax.security.auth.Destroyable`

      public class BCRainbowPrivateKey
      extends java.lang.Object
      implements java.security.PrivateKey

  The Private key in Rainbow consists of the linear affine maps L1, L2 and the map F, consisting of quadratic polynomials. In this implementation, we denote: L1 = A1*x + b1 L2 = A2*x + b2

  The coefficients of the polynomials in F are stored in 3-dimensional arrays per layer. The indices of these arrays denote the polynomial, and the variables.

  More detailed information about the private key is to be found in the paper of Jintai Ding, Dieter Schmidt: Rainbow, a New Multivariable Polynomial Signature Scheme. ACNS 2005: 164-175 (https://dx.doi.org/10.1007/11496137_12)

  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `BCRainbowPrivateKey​(short[][] A1inv, short[] b1, short[][] A2inv, short[] b2, int[] vi, Layer[] layers)` | Constructor.
    `BCRainbowPrivateKey​(RainbowPrivateKeyParameters params)` |
    `BCRainbowPrivateKey​(RainbowPrivateKeySpec keySpec)` | Constructor (used by the `RainbowKeyFactorySpi`).

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `equals​(java.lang.Object other)` | Compare this Rainbow private key with another object.
    `java.lang.String` | `getAlgorithm()` |
    `short[]` | `getB1()` | Getter for the translation part of the private quadratic map L1.
    `short[]` | `getB2()` | Getter for the translation part of the private quadratic map L2.
    `byte[]` | `getEncoded()` |
    `java.lang.String` | `getFormat()` |
    `short[][]` | `getInvA1()` | Getter for the inverse matrix of A1.
    `short[][]` | `getInvA2()` | Getter for the inverse matrix of A2
    `Layer[]` | `getLayers()` | Returns the layers contained in the private key
    `int[]` | `getVi()` | Returns the array of vi-s
    `int` | `hashCode()` |

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

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

    - ### Methods inherited from interface javax.security.auth.Destroyable

      `destroy, isDestroyed`

- - ### Constructor Detail

    - #### BCRainbowPrivateKey

          public BCRainbowPrivateKey​(short[][] A1inv,
                                     short[] b1,
                                     short[][] A2inv,
                                     short[] b2,
                                     int[] vi,
                                     Layer[] layers)

      Constructor.
      Parameters:
        `A1inv` -
        `b1` -
        `A2inv` -
        `b2` -
        `layers` -

    - #### BCRainbowPrivateKey

          public BCRainbowPrivateKey​(RainbowPrivateKeySpec keySpec)

      Constructor (used by the `RainbowKeyFactorySpi`).
      Parameters:
        `keySpec` - a `RainbowPrivateKeySpec`

    - #### BCRainbowPrivateKey

          public BCRainbowPrivateKey​(RainbowPrivateKeyParameters params)

  - ### Method Detail

    - #### getInvA1

          public short[][] getInvA1()

      Getter for the inverse matrix of A1.
      Returns:
        the A1inv inverse

    - #### getB1

          public short[] getB1()

      Getter for the translation part of the private quadratic map L1.
      Returns:
        b1 the translation part of L1

    - #### getB2

          public short[] getB2()

      Getter for the translation part of the private quadratic map L2.
      Returns:
        b2 the translation part of L2

    - #### getInvA2

          public short[][] getInvA2()

      Getter for the inverse matrix of A2
      Returns:
        the A2inv

    - #### getLayers

          public Layer[] getLayers()

      Returns the layers contained in the private key
      Returns:
        layers

    - #### getVi

          public int[] getVi()

      Returns the array of vi-s
      Returns:
        the vi

    - #### equals

          public boolean equals​(java.lang.Object other)

      Compare this Rainbow private key with another object.
      Overrides:
        `equals` in class `java.lang.Object`
      Parameters:
        `other` - the other object
      Returns:
        the result of the comparison

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### getAlgorithm

          public final java.lang.String getAlgorithm()

      Specified by:
        `getAlgorithm` in interface `java.security.Key`
      Returns:
        name of the algorithm - "Rainbow"

    - #### getEncoded

          public byte[] getEncoded()

      Specified by:
        `getEncoded` in interface `java.security.Key`

    - #### getFormat

          public java.lang.String getFormat()

      Specified by:
        `getFormat` in interface `java.security.Key`