de.flexiprovider.pqc.hbc.cmss
Class CMSSPrivateKey

java.lang.Object
  |
  +--de.flexiprovider.api.keys.PrivateKey
        |
        +--de.flexiprovider.pqc.hbc.cmss.CMSSPrivateKey
All Implemented Interfaces:
java.security.Key, Key, java.security.PrivateKey, java.io.Serializable

public class CMSSPrivateKey
extends PrivateKey

This class implements a CMSS private key and is usually initiated by the CMSSKeyPairGenerator.

Author:
Elena Klintsevich, Martin D�ring
See Also:
CMSSKeyPairGenerator, CMSSPrivateKeySpec, Serialized Form

Fields inherited from interface java.security.Key
serialVersionUID
 
Fields inherited from interface java.security.PrivateKey
serialVersionUID
 
Constructor Summary
protected CMSSPrivateKey(CMSSPrivateKeySpec keySpec)
          Construct a new CMSS2 private key from the given key specification.
protected CMSSPrivateKey(java.lang.String oid, int indexMain, int indexSub, int heightOfTrees, byte[][] seeds, BDSAuthPath[] authPath, int activeSubtree, byte[] subtreeRootSig, byte[] maintreeOTSVerificationKey, byte[][][] masks)
          Construct a new CMSS2 private key.
 
Method Summary
 boolean equals(java.lang.Object other)
          Compare this CMSS2 private key with another object.
protected  int getActiveSubtree()
           
 java.lang.String getAlgorithm()
           
protected  codec.asn1.ASN1Type getAlgParams()
           
protected  BDSAuthPath[] getAuthPath()
           
protected  int getHeightOfTrees()
           
protected  int getIndexMain()
           
protected  int getIndexSub()
           
protected  byte[] getKeyData()
          Return the key data to encode in the SubjectPublicKeyInfo structure.
protected  byte[] getMaintreeOTSVerificationKey()
           
protected  byte[][][] getMasks()
           
protected  int getNumLeafs()
           
protected  codec.asn1.ASN1ObjectIdentifier getOID()
           
protected  java.lang.String getOIDString()
           
protected  byte[][] getSeeds()
           
protected  int getSeedSize()
           
protected  byte[] getSubtreeRootSig()
           
 int hashCode()
           
 java.lang.String toString()
           
protected  void update(int indexMain, int indexSub, byte[][] seeds, BDSAuthPath[] authPath, int activeSubtree, byte[] subtreeRootSig, byte[] maintreeOTSVerificationKey)
          Update the private key components.
 
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

CMSSPrivateKey

protected CMSSPrivateKey(java.lang.String oid,
                         int indexMain,
                         int indexSub,
                         int heightOfTrees,
                         byte[][] seeds,
                         BDSAuthPath[] authPath,
                         int activeSubtree,
                         byte[] subtreeRootSig,
                         byte[] maintreeOTSVerificationKey,
                         byte[][][] masks)
Construct a new CMSS2 private key.
Parameters:
oid - the OID of the algorithm
indexMain - main tree index
indexSub - subtree index
heightOfTrees - height of trees
seeds - array of seeds for the key generation
authPath - array of authentication paths
subtreeRootSig - the one-time signature of the root of the current subtree
maintreeOTSPubKey - the one-time public key used to verify the rootSignature of the subtree

CMSSPrivateKey

protected CMSSPrivateKey(CMSSPrivateKeySpec keySpec)
Construct a new CMSS2 private key from the given key specification.
Parameters:
keySpec - a CMSS2PrivateKeySpec
Method Detail

update

protected void update(int indexMain,
                      int indexSub,
                      byte[][] seeds,
                      BDSAuthPath[] authPath,
                      int activeSubtree,
                      byte[] subtreeRootSig,
                      byte[] maintreeOTSVerificationKey)
Update the private key components.
Parameters:
indexMain - main tree index
indexSub - subtree index
seeds - array of seeds for the key generation
authPaths - array of authentication paths
subtreeRootSig - the one-time signature of the root of the current subtree
maintreeOTSPubKey - the one-time public key used to verify the rootSignature of the subtree

getAlgorithm

public java.lang.String getAlgorithm()
Returns:
the OID of the algorithm

getOIDString

protected java.lang.String getOIDString()
Returns:
the OID of the algorithm

getHeightOfTrees

protected int getHeightOfTrees()
Returns:
the height of the authentication trees

getNumLeafs

protected int getNumLeafs()
Returns:
the number of leafs of each tree

getSeedSize

protected int getSeedSize()
Returns:
the size of the seed used for key pair generation

getIndexMain

protected int getIndexMain()
Returns:
the main tree index

getIndexSub

protected int getIndexSub()
Returns:
the subtree index

getSeeds

protected byte[][] getSeeds()
Returns:
the seeds

getAuthPath

protected BDSAuthPath[] getAuthPath()
Returns:
the authentication paths

getActiveSubtree

protected int getActiveSubtree()
Returns:
the active Subtree

getSubtreeRootSig

protected byte[] getSubtreeRootSig()
Returns:
the one-time signature of the root of the current subtree

getMaintreeOTSVerificationKey

protected byte[] getMaintreeOTSVerificationKey()
Returns:
the one-time public key used to verify the rootSignature of the subtree

getMasks

protected byte[][][] getMasks()

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

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

    CMSS2PrivateKey ::= SEQUENCE {
      oid                           OBJECT IDENTIFIER  -- OID identifying the algorithm
      indexMain                     INTEGER            -- main tree index
      indexSub                      INTEGER            -- subtree index
      heightOfTrees                 INTEGER            -- height of trees
      seeds[0]                      BIT STRING         -- seed for the main tree
      seeds[1]                      BIT STRING         -- seed for the subtree
      seeds[2]                      BIT STRING         -- seed for the next subtree
      authPaths[0]                  AUTHPATH           -- authentication path of main tree
      authPaths[1]                  AUTHPATH           -- authentication path of subtree
      authPaths[2]                  AUTHPATH           -- authentication path of next subtree
      activeSubtree                 INTEGER            -- active subtree
      subtreeRootSig                OCTET STRING       -- the one-time signature of the root of the current subtree
      maintreeOTSVerificationKey    OCTET STRING       -- the current verification key used in the maintree
      leftMasks	   		  SECUENCE OF OCTET STRING		      
     						     -- the left masks for spr-cmss
      rightMasks	   		  SECUENCE OF OCTET STRING		      
      						     -- the right masks for spr-cmss
    }
 
Overrides:
getKeyData in class PrivateKey
Returns:
the keyData to encode in the SubjectPublicKeyInfo structure