Bouncy Castle Cryptography Library 1.48

org.bouncycastle.pqc.jcajce.provider.mceliece
Class BCMcEliecePublicKey

java.lang.Object
  extended by org.bouncycastle.pqc.jcajce.provider.mceliece.BCMcEliecePublicKey
All Implemented Interfaces:
java.io.Serializable, java.security.Key, java.security.PublicKey, CipherParameters

public class BCMcEliecePublicKey
extends java.lang.Object
implements CipherParameters, java.security.PublicKey

This class implements a McEliece public key and is usually instantiated by the McElieceKeyPairGenerator or McElieceKeyFactorySpi.

See Also:
Serialized Form

Constructor Summary
BCMcEliecePublicKey(McEliecePublicKeyParameters params)
           
BCMcEliecePublicKey(McEliecePublicKeySpec keySpec)
          Constructor (used by the McElieceKeyFactorySpi).
BCMcEliecePublicKey(java.lang.String oid, int n, int t, GF2Matrix g)
          Constructor (used by the McElieceKeyPairGenerator).
 
Method Summary
 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.
 java.lang.String getFormat()
           
 GF2Matrix getG()
           
 int getK()
           
 McElieceParameters getMcElieceParameters()
           
 int getN()
           
protected  ASN1ObjectIdentifier getOID()
           
 java.lang.String getOIDString()
           
 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

BCMcEliecePublicKey

public BCMcEliecePublicKey(java.lang.String oid,
                           int n,
                           int t,
                           GF2Matrix g)
Constructor (used by the McElieceKeyPairGenerator).

Parameters:
oid -
n - the length of the code
t - the error correction capability of the code
g - the generator matrix

BCMcEliecePublicKey

public BCMcEliecePublicKey(McEliecePublicKeySpec keySpec)
Constructor (used by the McElieceKeyFactorySpi).

Parameters:
keySpec - a McEliecePublicKeySpec

BCMcEliecePublicKey

public BCMcEliecePublicKey(McEliecePublicKeyParameters 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 error correction capability of the code

getG

public GF2Matrix getG()
Returns:
the generator matrix

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

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

getMcElieceParameters

public McElieceParameters getMcElieceParameters()

Bouncy Castle Cryptography Library 1.48