de.flexiprovider.pqc.hbc.ots
Class BiBaOTS

java.lang.Object
  |
  +--de.flexiprovider.pqc.hbc.ots.BiBaOTS
All Implemented Interfaces:
OTS

public class BiBaOTS
extends java.lang.Object
implements OTS

This class implements key pair generation and signature generation of the BiBa one-time signature scheme. The class can be used by the CMSS classes.


Constructor Summary
BiBaOTS()
          Constructor.
BiBaOTS(java.lang.Integer collisionSize, java.lang.Integer numberOfBins, java.lang.Integer numberOfSeals, java.lang.Integer sealLength)
          Initialize the BiBaOTS with desired parameters.
 
Method Summary
 boolean canComputeVerificationKeyFromSignature()
          Indicates whether the signature scheme supports the computation of the verification key out of the signature.
 byte[] computeVerificationKey(byte[] bytes, byte[] sigBytes)
          BiBaOTS can not compute the verification key out of the signature.
 void generateKeyPair(byte[] seed)
          Generates an OTS key pair using the given seed and the message digest and PRNG specified via init(MessageDigest, PRNG).
 void generateSignatureKey(byte[] seed)
          Generates the private key and stores it in the privKeyBytes variable.
 void generateVerificationKey()
          Generates the public key and stores it in the pubKeyBytes variable.
 int getSignatureLength()
          BiBaOTS has not a constant signature length.
 byte[] getVerificationKey()
           
 int getVerificationKeyLength()
           
 void init(MessageDigest md, PRNG rng)
          Initializes the OTS.
 byte[] sign(byte[] message)
          Generates a BiBa One Time Signature for the message according to the previously specified parameters.
 boolean verify(byte[] mBytes, byte[] sBytes, byte[] pBytes)
          Verifies if a signature is valid for the specified message using the specified verification key.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BiBaOTS

public BiBaOTS()
Constructor. Initializes the BiBaOTS with standard values for collisionSize, numberOfBins, numberOfseals and sealLength

BiBaOTS

public BiBaOTS(java.lang.Integer collisionSize,
               java.lang.Integer numberOfBins,
               java.lang.Integer numberOfSeals,
               java.lang.Integer sealLength)
Initialize the BiBaOTS with desired parameters. If one parameter is null then the standard value for this parameter will be used.
Parameters:
collisionSize - The collision size (or the number of seals which form a signature).
numberOfBins - Number of bins on which the seals are to be spread.
numberOfSeals - Number of seals (determines the length of the keys).
sealLength - The length of a seal in bytes. Has impact on the length of signature and private key.
Method Detail

init

public void init(MessageDigest md,
                 PRNG rng)
Initializes the OTS.
Specified by:
init in interface OTS
Parameters:
md - the hash function for the OTS
rng - the name of the PRNG used for key pair generation

canComputeVerificationKeyFromSignature

public boolean canComputeVerificationKeyFromSignature()
Indicates whether the signature scheme supports the computation of the verification key out of the signature.
Specified by:
canComputeVerificationKeyFromSignature in interface OTS
Returns:
false. BiBaOTS can not compute the verification key out of the signature.

computeVerificationKey

public byte[] computeVerificationKey(byte[] bytes,
                                     byte[] sigBytes)
BiBaOTS can not compute the verification key out of the signature.
Specified by:
computeVerificationKey in interface OTS
Returns:
null.

generateKeyPair

public void generateKeyPair(byte[] seed)
Generates an OTS key pair using the given seed and the message digest and PRNG specified via init(MessageDigest, PRNG).
Specified by:
generateKeyPair in interface OTS
Parameters:
seed - the seed for the PRGN

generateSignatureKey

public void generateSignatureKey(byte[] seed)
Generates the private key and stores it in the privKeyBytes variable.
Specified by:
generateSignatureKey in interface OTS
Following copied from interface: de.flexiprovider.pqc.hbc.ots.OTS
Parameters:
seed - the seed for the PRGN

generateVerificationKey

public void generateVerificationKey()
Generates the public key and stores it in the pubKeyBytes variable.
Specified by:
generateVerificationKey in interface OTS

getSignatureLength

public int getSignatureLength()
BiBaOTS has not a constant signature length. The signature length depends on the counter used for the signature generation. Usually is signatureSize = collisionSize * sealLength + 1. This size is not guaranteed but extremely probable when the standard parameters are used.
Specified by:
getSignatureLength in interface OTS
Returns:
(The most probable) Signature size in bytes.

getVerificationKey

public byte[] getVerificationKey()
Specified by:
getVerificationKey in interface OTS
Returns:
The verification OTS key as byte array.

getVerificationKeyLength

public int getVerificationKeyLength()
Specified by:
getVerificationKeyLength in interface OTS
Returns:
the length of the verification key (number of bytes).

sign

public byte[] sign(byte[] message)
Generates a BiBa One Time Signature for the message according to the previously specified parameters.
Specified by:
sign in interface OTS
Parameters:
The - message to sign.
Returns:
The BiBaOTS for the message.

verify

public boolean verify(byte[] mBytes,
                      byte[] sBytes,
                      byte[] pBytes)
Verifies if a signature is valid for the specified message using the specified verification key.
Specified by:
verify in interface OTS
Parameters:
mBytes - The message whose signature is about to be verified as byte array.
sBytes - The signature for the message as byte array.
pBytes - The corresponding verification key as byte array.
Returns:
true if the signature is valid, else false.