Class BCMcEliecePublicKey

java.lang.Object
org.bouncycastle.pqc.jcajce.provider.mceliece.BCMcEliecePublicKey
All Implemented Interfaces:
Serializable, Key, PublicKey

public class BCMcEliecePublicKey extends Object implements PublicKey
This class implements a McEliece public key and is usually instantiated by the McElieceKeyPairGenerator or McElieceKeyFactorySpi.
See Also:
  • Constructor Details

  • Method Details

    • getAlgorithm

      public String getAlgorithm()
      Return the name of the algorithm.
      Specified by:
      getAlgorithm in interface 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 error correction capability of the code
    • getG

      public GF2Matrix getG()
      Returns:
      the generator matrix
    • toString

      public String toString()
      Overrides:
      toString in class Object
      Returns:
      a human readable form of the key
    • equals

      public boolean equals(Object other)
      Compare this key with another object.
      Overrides:
      equals in class Object
      Parameters:
      other - the other object
      Returns:
      the result of the comparison
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
      Returns:
      the hash code of this key
    • getEncoded

      public byte[] getEncoded()
      Return the keyData to encode in the SubjectPublicKeyInfo structure.

      The ASN.1 definition of the key structure is

             McEliecePublicKey ::= SEQUENCE {
               n           Integer      -- length of the code
               t           Integer      -- error correcting capability
               matrixG     OctetString  -- generator matrix as octet string
             }
       
      Specified by:
      getEncoded in interface Key
      Returns:
      the keyData to encode in the SubjectPublicKeyInfo structure
    • getFormat

      public String getFormat()
      Specified by:
      getFormat in interface Key