de.flexiprovider.pqc.ecc.mceliece
Class McEliecePublicKey

java.lang.Object
  |
  +--de.flexiprovider.api.keys.PublicKey
        |
        +--de.flexiprovider.pqc.ecc.mceliece.McEliecePublicKey
All Implemented Interfaces:
java.security.Key, Key, java.security.PublicKey, java.io.Serializable

public class McEliecePublicKey
extends PublicKey

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

Author:
Elena Klintsevich
See Also:
Serialized Form

Fields inherited from interface java.security.Key
serialVersionUID
 
Fields inherited from interface java.security.PublicKey
serialVersionUID
 
Constructor Summary
protected McEliecePublicKey(int n, int t, GF2Matrix g)
          Constructor (used by the McElieceKeyPairGenerator).
protected McEliecePublicKey(McEliecePublicKeySpec keySpec)
          Constructor (used by the McElieceKeyFactory).
 
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  codec.asn1.ASN1Type getAlgParams()
           
protected  GF2Matrix getG()
           
protected  int getK()
           
protected  byte[] getKeyData()
          Return the keyData to encode in the SubjectPublicKeyInfo structure.
protected  int getN()
           
protected  codec.asn1.ASN1ObjectIdentifier getOID()
           
protected  int getT()
           
 int hashCode()
           
 java.lang.String toString()
           
 
Methods inherited from class de.flexiprovider.api.keys.PublicKey
getEncoded, getFormat
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

McEliecePublicKey

protected McEliecePublicKey(int n,
                            int t,
                            GF2Matrix g)
Constructor (used by the McElieceKeyPairGenerator).
Parameters:
n - the length of the code
t - the error correction capability of the code
g - the generator matrix

McEliecePublicKey

protected McEliecePublicKey(McEliecePublicKeySpec keySpec)
Constructor (used by the McElieceKeyFactory).
Parameters:
keySpec - a McEliecePublicKeySpec
Method Detail

getAlgorithm

public java.lang.String getAlgorithm()
Return the name of the algorithm.
Returns:
"McEliece"

getN

protected int getN()
Returns:
the length of the code

getK

protected int getK()
Returns:
the dimension of the code

getT

protected int getT()
Returns:
the error correction capability of the code

getG

protected 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

getOID

protected codec.asn1.ASN1ObjectIdentifier getOID()
Overrides:
getOID in class PublicKey
Returns:
the OID to encode in the SubjectPublicKeyInfo structure

getAlgParams

protected codec.asn1.ASN1Type getAlgParams()
Overrides:
getAlgParams in class PublicKey
Returns:
the algorithm parameters to encode in the SubjectPublicKeyInfo structure

getKeyData

protected byte[] getKeyData()
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
       }
 
Overrides:
getKeyData in class PublicKey
Returns:
the keyData to encode in the SubjectPublicKeyInfo structure