de.flexiprovider.pqc.ecc.mceliece
Class McEliecePrivateKey

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

public class McEliecePrivateKey
extends PrivateKey

This class implements a McEliece private 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.PrivateKey
serialVersionUID
 
Constructor Summary
protected McEliecePrivateKey(int n, int k, GF2mField field, PolynomialGF2mSmallM goppaPoly, GF2Matrix sInv, Permutation p1, Permutation p2, GF2Matrix h, PolynomialGF2mSmallM[] qInv)
          Constructor (used by the McElieceKeyPairGenerator).
protected McEliecePrivateKey(McEliecePrivateKeySpec 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  GF2mField getField()
           
protected  PolynomialGF2mSmallM getGoppaPoly()
           
protected  GF2Matrix getH()
           
protected  int getK()
           
protected  byte[] getKeyData()
          Return the key data to encode in the SubjectPublicKeyInfo structure.
protected  int getN()
           
protected  codec.asn1.ASN1ObjectIdentifier getOID()
           
protected  Permutation getP1()
           
protected  Permutation getP2()
           
protected  PolynomialGF2mSmallM[] getQInv()
           
protected  GF2Matrix getSInv()
           
 int hashCode()
           
 java.lang.String toString()
           
 
Methods inherited from class de.flexiprovider.api.keys.PrivateKey
getEncoded, getFormat
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

McEliecePrivateKey

protected McEliecePrivateKey(int n,
                             int k,
                             GF2mField field,
                             PolynomialGF2mSmallM goppaPoly,
                             GF2Matrix sInv,
                             Permutation p1,
                             Permutation p2,
                             GF2Matrix h,
                             PolynomialGF2mSmallM[] qInv)
Constructor (used by the McElieceKeyPairGenerator).
Parameters:
n - the length of the code
k - the dimension of the code
field - the field polynomial defining the finite field GF(2m)
goppaPoly - the irreducible Goppa polynomial
sInv - the matrix S-1
p1 - the permutation used to generate the systematic check matrix
p2 - the permutation used to compute the public generator matrix
h - the canonical check matrix
qInv - the matrix used to compute square roots in (GF(2m))t

McEliecePrivateKey

protected McEliecePrivateKey(McEliecePrivateKeySpec keySpec)
Constructor (used by the McElieceKeyFactory).
Parameters:
keySpec - a McEliecePrivateKeySpec
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

getField

protected GF2mField getField()
Returns:
the finite field

getGoppaPoly

protected PolynomialGF2mSmallM getGoppaPoly()
Returns:
the irreducible Goppa polynomial

getSInv

protected GF2Matrix getSInv()
Returns:
the k x k random binary non-singular matrix S

getP1

protected Permutation getP1()
Returns:
the permutation used to generate the systematic check matrix

getP2

protected Permutation getP2()
Returns:
the permutation used to compute the public generator matrix

getH

protected GF2Matrix getH()
Returns:
the canonical check matrix

getQInv

protected PolynomialGF2mSmallM[] getQInv()
Returns:
the matrix for computing 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

getOID

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

getAlgParams

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

getKeyData

protected byte[] getKeyData()
Return the key data to encode in the SubjectPublicKeyInfo structure.

The ASN.1 definition of the key structure is

   McEliecePrivateKey ::= SEQUENCE {
     n          INTEGER                   -- length of the code
     k          INTEGER                   -- dimension of the code
     fieldPoly  OCTET STRING              -- field polynomial defining GF(2ˆm)
     goppaPoly  OCTET STRING              -- irreducible Goppa polynomial
     sInv       OCTET STRING              -- matrix Sˆ-1
     p1         OCTET STRING              -- permutation P1
     p2         OCTET STRING              -- permutation P2
     h          OCTET STRING              -- canonical check matrix
     qInv       SEQUENCE OF OCTET STRING  -- matrix used to compute square roots	
   }
 
Overrides:
getKeyData in class PrivateKey
Returns:
the key data to encode in the SubjectPublicKeyInfo structure