de.flexiprovider.pqc.tss
Class TSS

java.lang.Object
  |
  +--java.security.SignatureSpi
        |
        +--de.flexiprovider.api.Signature
              |
              +--de.flexiprovider.pqc.tss.TSS
Direct Known Subclasses:
TSS.RIPEMD128, TSS.RIPEMD160, TSS.RIPEMD256, TSS.RIPEMD320, TSS.SHA1, TSS.SHA224, TSS.SHA256, TSS.SHA384, TSS.SHA512

public abstract class TSS
extends Signature


Inner Class Summary
static class TSS.RIPEMD128
          TSS with RIPEMD128
static class TSS.RIPEMD160
          TSS with RIPEMD160
static class TSS.RIPEMD256
          TSS with RIPEMD256
static class TSS.RIPEMD320
          TSS with RIPEMD320
static class TSS.SHA1
          TSS with SHA1
static class TSS.SHA224
          TSS with SHA224
static class TSS.SHA256
          TSS with SHA256
static class TSS.SHA384
          TSS with SHA384
static class TSS.SHA512
          TSS with SHA512
 
Field Summary
protected  TSSHashFunction hashFunction
          the hash-function described in the document
protected  int m
           
protected  MessageDigest messageDigest
          the message-digest used for the hashfunction
protected  int n
           
protected  long p
           
 
Fields inherited from class java.security.SignatureSpi
appRandom
 
Constructor Summary
protected TSS(MessageDigest md)
           
 
Method Summary
 java.util.Vector addGFPVector(java.util.Vector a, java.util.Vector b)
          Adds two Vectors of TSSPolynomial by adding the Polynomials in each Vector.
 long[] binary2ternary(byte[] binary)
           
 boolean checkBound(long[] arr, long bound)
          Checks if all of the values in the given array are smaller or equal the defined boundary
 boolean checkBound(java.util.Vector v, long bound)
          Checks if all of the values in the contained arrays are smaller or equal bound
static int floor2Log(int i)
           
 java.util.Vector getPolyVector(int limit, int amount)
          returns a Vector of TSSPolynomials
 void initSign(PrivateKey privKey, SecureRandom random)
          Initialize the signature with the specified private key and source of randomness for signing operations.
 void initVerify(PublicKey pubKey)
          Initialize the signature with the specified public key for verification operations.
 TSSPolynomial oracle(TSSPolynomial gfp, byte[] b)
          returns a pseudo random TSSPolynomial with values <= |1|
 void setParameters(AlgorithmParameterSpec params)
          Initialize the signature with the specified parameters.
 byte[] sign()
          Return the signature of all the data updated so far.
 void update(byte input)
          Update the data to be signed or verified using the specified byte.
 void update(byte[] input, int inOff, int inLen)
          Update the data to be signed or verified, using the specified byte array of the specified length, starting at the specified offset.
 boolean verify(byte[] signature)
          Verify the passed-in signature of the specified message.
 
Methods inherited from class de.flexiprovider.api.Signature
engineGetParameter, engineInitSign, engineInitSign, engineInitVerify, engineSetParameter, engineSetParameter, engineSign, engineUpdate, engineUpdate, engineVerify, engineVerify, initSign, sign, update, verify, verify, verify
 
Methods inherited from class java.security.SignatureSpi
clone, engineSign
 
Methods inherited from class java.lang.Object
, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

messageDigest

protected MessageDigest messageDigest
the message-digest used for the hashfunction

hashFunction

protected TSSHashFunction hashFunction
the hash-function described in the document

n

protected int n

m

protected int m

p

protected long p
Constructor Detail

TSS

protected TSS(MessageDigest md)
Method Detail

floor2Log

public static int floor2Log(int i)

addGFPVector

public java.util.Vector addGFPVector(java.util.Vector a,
                                     java.util.Vector b)
Adds two Vectors of TSSPolynomial by adding the Polynomials in each Vector. The Polynomial in Vector @a at position i is added to the Polynomial in Vector @b at position i. If one Vector is larger than the other, then the excess Polynomials of the larger Vector are not modified (Zero Poly added).
Parameters:
a - Vector containing TSSPolynomial
b - Vector containing TSSPolynomial
Returns:
The Vector of the added Polynomials

binary2ternary

public long[] binary2ternary(byte[] binary)

checkBound

public boolean checkBound(long[] arr,
                          long bound)
Checks if all of the values in the given array are smaller or equal the defined boundary
Parameters:
arr -  
bound -  
Returns:
 

checkBound

public boolean checkBound(java.util.Vector v,
                          long bound)
Checks if all of the values in the contained arrays are smaller or equal bound
Parameters:
v - a Vector containing long[]
bound -  
Returns:
 

getPolyVector

public java.util.Vector getPolyVector(int limit,
                                      int amount)
returns a Vector of TSSPolynomials
Parameters:
limit - the limit of the elements in the polynomials (eg: 2 to receive polynomials with the values {-1, 0, 1})
amount - the amount of Polynomials in the vector
Returns:
the Vector of Polynomials

initSign

public void initSign(PrivateKey privKey,
                     SecureRandom random)
              throws InvalidKeyException
Description copied from class: Signature
Initialize the signature with the specified private key and source of randomness for signing operations.
Overrides:
initSign in class Signature
Following copied from class: de.flexiprovider.api.Signature
Parameters:
privKey - the private key of the identity whose signature will be generated.
random - the source of randomness
Throws:
InvalidKeyException - if the key is invalid for initializing the signature.

initVerify

public void initVerify(PublicKey pubKey)
                throws InvalidKeyException
Description copied from class: Signature
Initialize the signature with the specified public key for verification operations.
Overrides:
initVerify in class Signature
Following copied from class: de.flexiprovider.api.Signature
Parameters:
pubKey - the public key of the identity whose signature is going to be verified
Throws:
InvalidKeyException - if the key is invalid for initializing the signature.

oracle

public TSSPolynomial oracle(TSSPolynomial gfp,
                            byte[] b)
returns a pseudo random TSSPolynomial with values <= |1|
Parameters:
u - the input byte array for which to create the pseudo random output
Returns:
a pseudo random TSSPolynomial
Throws:
java.io.IOException -  
codec.asn1.ASN1Exception -  

setParameters

public void setParameters(AlgorithmParameterSpec params)
                   throws InvalidAlgorithmParameterException
Description copied from class: Signature
Initialize the signature with the specified parameters.
Overrides:
setParameters in class Signature
Following copied from class: de.flexiprovider.api.Signature
Parameters:
params - the parameters
Throws:
InvalidAlgorithmParameterException - if the given parameters are inappropriate for this signature.

sign

public byte[] sign()
Description copied from class: Signature
Return the signature of all the data updated so far.
Overrides:
sign in class Signature
Following copied from class: de.flexiprovider.api.Signature
Returns:
the signature
Throws:
SignatureException - if the engine is not initialized properly.

update

public void update(byte input)
            throws SignatureException
Description copied from class: Signature
Update the data to be signed or verified using the specified byte.
Overrides:
update in class Signature
Following copied from class: de.flexiprovider.api.Signature
Parameters:
input - the data byte
Throws:
SignatureException - if the engine is not initialized properly.

update

public void update(byte[] input,
                   int inOff,
                   int inLen)
            throws SignatureException
Description copied from class: Signature
Update the data to be signed or verified, using the specified byte array of the specified length, starting at the specified offset.
Overrides:
update in class Signature
Following copied from class: de.flexiprovider.api.Signature
Parameters:
input - the data byte array
inOff - the offset to start from in the array of bytes
inLen - the number of bytes to use, starting at inOff
Throws:
SignatureException - if the engine is not initialized properly

verify

public boolean verify(byte[] signature)
               throws SignatureException
Description copied from class: Signature
Verify the passed-in signature of the specified message.
Overrides:
verify in class Signature
Following copied from class: de.flexiprovider.api.Signature
Parameters:
signature - the signature
Returns:
true if the signature is valid, false otherwise.
Throws:
SignatureException - if the engine is not initialized properly or the passed-in signature is improperly encoded or of the wrong type.