de.flexiprovider.pqc.rainbow
Class RainbowSignature
java.lang.Object
|
+--java.security.SignatureSpi
|
+--de.flexiprovider.api.Signature
|
+--de.flexiprovider.pqc.rainbow.RainbowSignature
- public class RainbowSignature
- extends Signature
This class extends the Signature-class of the FlexiProvider-Api.
It implements the sign and verify functions for the Rainbow Signature Scheme.
Here the message, which has to be signed, is updated and hashed. The use of
different hash functions is possible.
Detailed information about the signature and the verify-method 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
| Fields inherited from class java.security.SignatureSpi |
appRandom |
|
Constructor Summary |
RainbowSignature()
Rainbow Signature Scheme using the following hashfunctions in descending
priority: |
|
Method Summary |
void |
initSign(PrivateKey privateKey,
SecureRandom random)
Initializes the signature algorithm for signing a message. |
void |
initVerify(PublicKey publicKey)
Initializes the signature algorithm for verifying a message. |
void |
setParameters(AlgorithmParameterSpec params)
Initializes this signature engine with the specified parameter set. |
byte[] |
sign()
This function signs the message that has been updated, making use of the
private key. |
void |
update(byte input)
Passes a message byte to the message digest. |
void |
update(byte[] input,
int inOff,
int inLen)
Passes message bytes to the message digest. |
boolean |
verify(byte[] signature)
This function verifies the signature of the message that has been
updated, with the aid of the public key. |
| 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 |
OID
public static final java.lang.String OID
rainbowParams
RainbowParameterSpec rainbowParams
signableDocumentLength
int signableDocumentLength
numOfHashBytes
int numOfHashBytes
RainbowSignature
public RainbowSignature()
- Rainbow Signature Scheme using the following hashfunctions in descending
priority:
- See Also:
SHA512,
SHA384,
SHA256,
SHA224,
SHA1,
RIPEMD320,
RIPEMD256,
RIPEMD160,
RIPEMD128,
MD5
initSign
public void initSign(PrivateKey privateKey,
SecureRandom random)
throws InvalidKeyException
- Initializes the signature algorithm for signing a message.
- Overrides:
initSign in class Signature
- Parameters:
privateKey - the private key of the signaturerandom - the source of randomness- Throws:
InvalidKeyException - if the key is not an instance of RSAPrivateKey or
RSAPrivateCrtKey.
initVerify
public void initVerify(PublicKey publicKey)
throws InvalidKeyException
- Initializes the signature algorithm for verifying a message.
- Overrides:
initVerify in class Signature
- Parameters:
pubKey - public key of signer- Throws:
InvalidKeyException - if the key is not an instance of RainbowPublicKey
setParameters
public void setParameters(AlgorithmParameterSpec params)
throws InvalidAlgorithmParameterException
- Initializes this signature engine with the specified parameter set.
- Overrides:
setParameters in class Signature
- Parameters:
params - the parameters- Throws:
InvalidAlgorithmParameterException. - if the given parameters are
inappropriate for this signature engine.
update
public void update(byte input)
throws SignatureException
- Passes a message byte to the message digest.
- Overrides:
update in class Signature
- Parameters:
b - the message byte.
update
public void update(byte[] input,
int inOff,
int inLen)
throws SignatureException
- Passes message bytes to the message digest.
- Overrides:
update in class Signature
- Parameters:
b - the message bytes.offset - the index where the message bytes starts.length - the number of message bytes.
sign
public byte[] sign()
throws SignatureException
- This function signs the message that has been updated, making use of the
private key.
For computing the signature, L1 and L2 are needed, as well as LES should
be solved for each layer in order to find the Oil-variables in the layer.
The Vinegar-variables of the first layer are random generated.
- Overrides:
sign in class Signature
- Returns:
- the signature of the message.
verify
public boolean verify(byte[] signature)
throws SignatureException
- This function verifies the signature of the message that has been
updated, with the aid of the public key.
- Overrides:
verify in class Signature
- Parameters:
the - signature of the message is given as a byte array.- Returns:
- true if the signature has been verified, false otherwise.