Class HSSSigner
java.lang.Object
org.bouncycastle.crypto.signers.HSSSigner
- All Implemented Interfaces:
Signer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]generate a signature for the message we've been loaded with using the key we were initialised with.byte[]generateSignature(byte[] message) Sign the passed in message.voidinit(boolean forSigning, CipherParameters param) Initialise for signing or verification.voidreset()reset the internal statevoidupdate(byte b) Absorb a byte of the message to be signed or verified.voidupdate(byte[] in, int off, int len) update the internal digest with the byte array inbooleanverifySignature(byte[] signature) return true if the internal state represents the signature described in the passed in array.booleanverifySignature(byte[] message, byte[] signature) Verify the passed in signature against the passed in message.
-
Constructor Details
-
HSSSigner
public HSSSigner()
-
-
Method Details
-
init
Initialise for signing or verification. AParametersWithRandomwrapper is accepted and unwrapped, so a caller that supplies a random - as the operator builders do whenever setSecureRandom() has been called - is not refused; the random itself is not used. The message randomiser C is derived from the key's seed and the one-time index (RFC 8554 sec. 4.2, following the reference implementation), so it is deterministic and cannot repeat while q does not.- Specified by:
initin interfaceSigner- Parameters:
forSigning- true for signing, false for verification.param- the key, optionally wrapped inParametersWithRandom.
-
generateSignature
public byte[] generateSignature(byte[] message) Sign the passed in message. This is the one-shot form; it must not be mixed with the buffered form, so a call made with data already absorbed throughupdate(byte)is refused rather than silently discarding it - callreset()first, or usegenerateSignature()to sign what was buffered.- Parameters:
message- the message to be signed.- Returns:
- the signature.
- Throws:
IllegalStateException- if a buffered message is present, or the signer is not initialised for signing.
-
verifySignature
public boolean verifySignature(byte[] message, byte[] signature) Verify the passed in signature against the passed in message. This is the one-shot form; it must not be mixed with the buffered form, so a call made with data already absorbed throughupdate(byte)is refused rather than silently discarding it - callreset()first, or useverifySignature(byte[])to verify what was buffered.- Parameters:
message- the message the signature is claimed to be over.signature- the candidate signature.- Returns:
- true if the signature verifies, false otherwise.
- Throws:
IllegalStateException- if a buffered message is present, or the signer is not initialised for verification.
-
update
public void update(byte b) Absorb a byte of the message to be signed or verified. The buffered message is consumed bygenerateSignature()/verifySignature(byte[]), which reset the buffer. -
update
-
generateSignature
public byte[] generateSignature()Description copied from interface:Signergenerate a signature for the message we've been loaded with using the key we were initialised with.- Specified by:
generateSignaturein interfaceSigner
-
verifySignature
public boolean verifySignature(byte[] signature) Description copied from interface:Signerreturn true if the internal state represents the signature described in the passed in array.- Specified by:
verifySignaturein interfaceSigner
-
reset
-