BCMcElieceCCA2PrivateKey (Bouncy Castle Library 1.54 API Specification)
Date: 2015-12-29

org.bouncycastle.pqc.jcajce.provider.mceliece

## Class BCMcElieceCCA2PrivateKey

- java.lang.Object
- - org.bouncycastle.pqc.jcajce.provider.mceliece.BCMcElieceCCA2PrivateKey

- All Implemented Interfaces:
    java.io.Serializable, java.security.Key, java.security.PrivateKey, CipherParameters

      public class BCMcElieceCCA2PrivateKey
      extends java.lang.Object
      implements CipherParameters, java.security.PrivateKey

  This class implements a McEliece CCA2 private key and is usually instantiated by the `McElieceCCA2KeyPairGenerator` or `McElieceCCA2KeyFactorySpi`.
  See Also:
    `McElieceCCA2KeyPairGenerator`, Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BCMcElieceCCA2PrivateKey(McElieceCCA2PrivateKeyParameters params)`
    `BCMcElieceCCA2PrivateKey(McElieceCCA2PrivateKeySpec keySpec)` Constructor (used by the `McElieceCCA2KeyFactorySpi`).
    `BCMcElieceCCA2PrivateKey(java.lang.String oid, int n, int k, GF2mField field, PolynomialGF2mSmallM gp, Permutation p, GF2Matrix h, PolynomialGF2mSmallM[] qInv)` Constructor (used by the `McElieceCCA2KeyPairGenerator`).

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(java.lang.Object other)` Compare this key with another object.
    `java.lang.String` | `getAlgorithm()` Return the name of the algorithm.
    `protected ASN1Primitive` | `getAlgParams()`
    `byte[]` | `getEncoded()` Return the keyData to encode in the SubjectPublicKeyInfo structure.
    `GF2mField` | `getField()`
    `java.lang.String` | `getFormat()`
    `PolynomialGF2mSmallM` | `getGoppaPoly()`
    `GF2Matrix` | `getH()`
    `int` | `getK()`
    `McElieceCCA2Parameters` | `getMcElieceCCA2Parameters()`
    `int` | `getN()`
    `protected ASN1ObjectIdentifier` | `getOID()`
    `java.lang.String` | `getOIDString()`
    `Permutation` | `getP()`
    `PolynomialGF2mSmallM[]` | `getQInv()`
    `int` | `getT()`
    `int` | `hashCode()`
    `java.lang.String` | `toString()`

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

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

- - ### Constructor Detail

    - #### BCMcElieceCCA2PrivateKey

          public BCMcElieceCCA2PrivateKey(java.lang.String oid,
                                  int n,
                                  int k,
                                  GF2mField field,
                                  PolynomialGF2mSmallM gp,
                                  Permutation p,
                                  GF2Matrix h,
                                  PolynomialGF2mSmallM[] qInv)

      Constructor (used by the `McElieceCCA2KeyPairGenerator`).
      Parameters:
        `n` - the length of the code
        `k` - the dimension of the code
        `field` - the field polynomial
        `gp` - the irreducible Goppa polynomial
        `p` - the permutation
        `h` - the canonical check matrix
        `qInv` - the matrix used to compute square roots in `(GF(2^m))^t`

    - #### BCMcElieceCCA2PrivateKey

          public BCMcElieceCCA2PrivateKey(McElieceCCA2PrivateKeySpec keySpec)

      Constructor (used by the `McElieceCCA2KeyFactorySpi`).
      Parameters:
        `keySpec` - a `McElieceCCA2PrivateKeySpec`

    - #### BCMcElieceCCA2PrivateKey

          public BCMcElieceCCA2PrivateKey(McElieceCCA2PrivateKeyParameters params)

  - ### Method Detail

    - #### getAlgorithm

          public java.lang.String getAlgorithm()

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

    - #### getN

          public int getN()

      Returns:
        the length of the code

    - #### getK

          public int getK()

      Returns:
        the dimension of the code

    - #### getT

          public int getT()

      Returns:
        the degree of the Goppa polynomial (error correcting capability)

    - #### getField

          public GF2mField getField()

      Returns:
        the finite field

    - #### getGoppaPoly

          public PolynomialGF2mSmallM getGoppaPoly()

      Returns:
        the irreducible Goppa polynomial

    - #### getP

          public Permutation getP()

      Returns:
        the permutation vector

    - #### getH

          public GF2Matrix getH()

      Returns:
        the canonical check matrix

    - #### getQInv

          public PolynomialGF2mSmallM[] getQInv()

      Returns:
        the matrix used to compute square roots in `(GF(2^m))^t`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        a human readable form of the key

    - #### equals

          public boolean equals(java.lang.Object other)

      Compare this 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`
      Returns:
        the hash code of this key

    - #### getOIDString

          public java.lang.String getOIDString()

      Returns:
        the OID of the algorithm

    - #### getOID

          protected ASN1ObjectIdentifier getOID()

      Returns:
        the OID to encode in the SubjectPublicKeyInfo structure

    - #### getAlgParams

          protected ASN1Primitive getAlgParams()

      Returns:
        the algorithm parameters to encode in the SubjectPublicKeyInfo structure

    - #### getEncoded

          public byte[] getEncoded()

      Return the keyData to encode in the SubjectPublicKeyInfo structure.

      The ASN.1 definition of the key structure is

             McEliecePrivateKey ::= SEQUENCE {
               m             INTEGER                  -- extension degree of the field
               k             INTEGER                  -- dimension of the code
               field         OCTET STRING             -- field polynomial
               goppaPoly     OCTET STRING             -- irreducible Goppa polynomial
               p             OCTET STRING             -- permutation vector
               matrixH       OCTET STRING             -- canonical check matrix
               sqRootMatrix  SEQUENCE OF OCTET STRING -- square root matrix
             }

      Specified by:
        `getEncoded` in interface `java.security.Key`
      Returns:
        the keyData to encode in the SubjectPublicKeyInfo structure

    - #### getFormat

          public java.lang.String getFormat()

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

    - #### getMcElieceCCA2Parameters

          public McElieceCCA2Parameters getMcElieceCCA2Parameters()