de.flexiprovider.pqc.rainbow
Class RainbowPrivateKey

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

public class RainbowPrivateKey
extends PrivateKey

This class extends PrivateKey of the FlexiProvider_API and implements, respectively overrides its methods for the Rainbow Signature Scheme The Private key in Rainbow consists of the linear affine maps L1, L2 and the map F, consisting of quadratic polynomials. In this implementation, we denote: L1 = A1*x + b1 L2 = A2*x + b2 The coefficients of the polynomials in F are stored in 3-dimensional arrays per layer. The indices of these arrays denote the polynomial, and the variables. More detailed information about the private key is to be found in the paper of Jintai Ding, Dieter Schmidt: Rainbow, a New Multivariable Polynomial Signature Scheme. ACNS 2005: 164-175 (http://dx.doi.org/10.1007/11496137_12)

Author:
Patrick Neugebauer, Marius Senftleben, Tsvetoslava Vateva
See Also:
RainbowKeyPairGenerator, Serialized Form

Fields inherited from interface java.security.Key
serialVersionUID
 
Fields inherited from interface java.security.PrivateKey
serialVersionUID
 
Constructor Summary
protected RainbowPrivateKey(RainbowPrivateKeySpec keySpec)
          Constructor (used by the RainbowKeyFactory).
protected RainbowPrivateKey(java.lang.String oid, short[][] A1inv, short[] b1, short[][] A2inv, short[] b2, int[] vi, Layer[] layers)
          Constructor (used by the RainbowKeyPairGenerator).
 
Method Summary
 boolean equals(java.lang.Object other)
          Compare this Rainbow private key with another object.
protected  short[][] getA1inv()
          Getter for the inverse matrix of A1.
protected  short[][] getA2inv()
          Getter for the inverse matrix of A2
 java.lang.String getAlgorithm()
           
protected  codec.asn1.ASN1Type getAlgParams()
           
protected  short[] getb1()
          Getter for the translation part of the private quadratic map L1.
protected  short[] getb2()
          Getter for the translation part of the private quadratic map L2.
protected  byte[] getKeyData()
          Return the key data to encode in the SubjectPublicKeyInfo structure.
protected  Layer[] getLayers()
          Returns the layers contained in the private key
protected  codec.asn1.ASN1ObjectIdentifier getOID()
           
protected  java.lang.String getOIDString()
           
protected  int[] getVi()
          Returns the array of vi-s
 
Methods inherited from class de.flexiprovider.api.keys.PrivateKey
getEncoded, getFormat
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RainbowPrivateKey

protected RainbowPrivateKey(java.lang.String oid,
                            short[][] A1inv,
                            short[] b1,
                            short[][] A2inv,
                            short[] b2,
                            int[] vi,
                            Layer[] layers)
Constructor (used by the RainbowKeyPairGenerator).
Parameters:
oid -  
A1inv -  
b1 -  
A2inv -  
b2 -  
vi -  
layers -  

RainbowPrivateKey

protected RainbowPrivateKey(RainbowPrivateKeySpec keySpec)
Constructor (used by the RainbowKeyFactory).
Parameters:
keySpec - a RainbowPrivateKeySpec
Method Detail

getA1inv

protected short[][] getA1inv()
Getter for the inverse matrix of A1.
Returns:
the A1inv inverse

getb1

protected short[] getb1()
Getter for the translation part of the private quadratic map L1.
Returns:
b1 the translation part of L1

getb2

protected short[] getb2()
Getter for the translation part of the private quadratic map L2.
Returns:
b2 the translation part of L2

getA2inv

protected short[][] getA2inv()
Getter for the inverse matrix of A2
Returns:
the A2inv

getLayers

protected Layer[] getLayers()
Returns the layers contained in the private key
Returns:
layers

getVi

protected int[] getVi()
Returns the array of vi-s
Returns:
the vi

equals

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

getAlgorithm

public final java.lang.String getAlgorithm()
Returns:
name of the algorithm - "Rainbow"

getOIDString

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

getAlgParams

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

getOID

protected codec.asn1.ASN1ObjectIdentifier getOID()
Overrides:
getOID in class PrivateKey
Returns:
the OID 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

   RainbowPrivateKey ::= SEQUENCE {
     oid        OBJECT IDENTIFIER         -- OID identifying the algorithm
     A1inv      SEQUENCE OF OCTET STRING  -- inversed matrix of L1
     b1         OCTET STRING              -- translation vector of L1
     A2inv      SEQUENCE OF OCTET STRING  -- inversed matrix of L2
     b2         OCTET STRING              -- translation vector of L2
     vi         OCTET STRING              -- num of elmts in each Set S 
     layers     SEQUENCE OF Layer         -- layers of F
   }
   
   Layer             ::= SEQUENCE OF Poly 
   
   Poly              ::= SEQUENCE {
     alpha      SEQUENCE OF OCTET STRING
     beta       SEQUENCE OF OCTET STRING
     gamma      OCTET STRING
     eta        INTEGER
   }
 
Overrides:
getKeyData in class PrivateKey
Returns:
the key data to encode in the SubjectPublicKeyInfo structure