Package org.bouncycastle.crypto.signers
Class HashMLDSASigner
java.lang.Object
org.bouncycastle.crypto.signers.HashMLDSASigner
- 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[] hash) Sign a message that has already been hashed externally.voidinit(boolean forSigning, CipherParameters param) Initialise the signer for signing or verification.voidreset()reset the internal statevoidupdate(byte b) update the internal digest with the byte bvoidupdate(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[] hash, byte[] signature) Verify a signature over a message that has already been hashed externally; companion togenerateSignature(byte[]).
-
Constructor Details
-
HashMLDSASigner
public HashMLDSASigner()
-
-
Method Details
-
init
Description copied from interface:SignerInitialise the signer for signing or verification. -
update
public void update(byte b) Description copied from interface:Signerupdate the internal digest with the byte b -
update
public void update(byte[] in, int off, int len) Description copied from interface:Signerupdate the internal digest with the byte array in -
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- Throws:
CryptoExceptionDataLengthException
-
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
-
generateSignature
Sign a message that has already been hashed externally. See FIPS 204 sec. 5.4 (HashML-DSA): the caller supplies the digest of the message and the signer absorbs it together with the DER encoding of the digest algorithm's OID (derived from the parameter set this signer was initialised with) into the mu computation, just as the streaming form would. The supplied hash must have been produced with the digest algorithm matching the configured parameter set.- Parameters:
hash- the digest of the message.- Returns:
- the ML-DSA signature.
- Throws:
CryptoExceptionDataLengthException
-
verifySignature
public boolean verifySignature(byte[] hash, byte[] signature) Verify a signature over a message that has already been hashed externally; companion togenerateSignature(byte[]).- Parameters:
hash- the digest of the message.signature- the candidate signature.- Returns:
- true if the signature is valid.
-
reset
public void reset()reset the internal state
-