de.flexiprovider.pqc.ots.lm
Class LMOTSSignature

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

public abstract class LMOTSSignature
extends Signature

This Class is used for generating and verifying Signatures according to the LMOTS Signature Scheme defined in the Paper "Asymptotically Efficient Lattice-Based Digital Signatures" by Vadim Lyubashevsky and Daniele Micciancio.

See Page 10 and 11 of the Paper for the algorithm step by step.


Inner Class Summary
static class LMOTSSignature.GENERIC
          LMOTS Signature with any hash function
static class LMOTSSignature.RIPEMD128
          LMOTS Signature with RIPEMD128
static class LMOTSSignature.RIPEMD160
          LMOTS Signature with RIPEMD160
static class LMOTSSignature.RIPEMD256
          LMOTS Signature with RIPEMD256
static class LMOTSSignature.RIPEMD320
          LMOTS Signature with RIPEMD320
static class LMOTSSignature.SHA1
          LMOTS Signature with SHA1
static class LMOTSSignature.SHA224
          LMOTS Signature with SHA224
static class LMOTSSignature.SHA256
          LMOTS Signature with SHA256
static class LMOTSSignature.SHA384
          LMOTS Signature with SHA384
static class LMOTSSignature.SHA512
          LMOTS Signature with SHA512
 
Fields inherited from class java.security.SignatureSpi
appRandom
 
Constructor Summary
protected LMOTSSignature(MessageDigest md)
          Constructor.
 
Method Summary
 int getSignatureLength()
           
 GFP32Polynomial hashSignature(byte[] signature)
          Hashes the LMOTS Signature as specified in LMOTSSignature
 void initSign(PrivateKey privKey, SecureRandom random)
          Initialize the signature algorithm for signing a message.
 void initVerify(PublicKey pubKey)
          Initialize the signature algorithm for verifying a signature.
 void setMessage(byte[] message)
           
 void setParameters(AlgorithmParameterSpec params)
          Initialize this signature engine with the specified parameter set
 byte[] sign()
          Sign a message.
 void update(byte input)
          Feed a message byte to the message digest.
 void update(byte[] input, int inOff, int inLen)
          Feed an array of message bytes to the message digest.
 boolean verify(byte[] signature)
          Verifies the supplied Signature
 
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
 

Constructor Detail

LMOTSSignature

protected LMOTSSignature(MessageDigest md)
Constructor.
Parameters:
md - the message digest
Method Detail

getSignatureLength

public int getSignatureLength()

hashSignature

public GFP32Polynomial hashSignature(byte[] signature)
Hashes the LMOTS Signature as specified in LMOTSSignature
Returns:
Returns the GFP32Polynomial of the hashed Signature

initSign

public void initSign(PrivateKey privKey,
                     SecureRandom random)
              throws InvalidKeyException
Initialize the signature algorithm for signing a message.
Overrides:
initSign in class Signature
Parameters:
privKey - the private key of the signer
random - a source of randomness (not used)
Throws:
InvalidKeyException - if the key is not an instance of LMOTSPrivateKey.

initVerify

public void initVerify(PublicKey pubKey)
                throws InvalidKeyException
Initialize the signature algorithm for verifying a signature.
Overrides:
initVerify in class Signature
Parameters:
pubKey - the public key of the signer.
Throws:
InvalidKeyException - if the public key is not an instance of LMOTSPublicKey.

setMessage

public void setMessage(byte[] message)

setParameters

public void setParameters(AlgorithmParameterSpec params)
                   throws InvalidAlgorithmParameterException
Initialize this signature engine with the specified parameter set
Overrides:
setParameters in class Signature
Parameters:
params - the parameters
Throws:
InvalidAlgorithmParameterException -  

sign

public byte[] sign()
Sign a message.
Overrides:
sign in class Signature
Returns:
the signature.

update

public void update(byte input)
Feed a message byte to the message digest.
Overrides:
update in class Signature
Parameters:
input - the message byte
Throws:
SignatureException -  

update

public void update(byte[] input,
                   int inOff,
                   int inLen)
Feed an array of message bytes to the message digest.
Overrides:
update in class Signature
Parameters:
input - the array of message bytes
inOff - index of message start
inLen - number of message bytes

verify

public boolean verify(byte[] signature)
               throws SignatureException
Verifies the supplied Signature
Overrides:
verify in class Signature
Parameters:
signature - the Signature byte array
Returns:
True if the Signature is valid, false otherwise.
Throws:
SignatureException - if the Verification fails