Class SM9Signer
java.lang.Object
org.bouncycastle.crypto.signers.SM9Signer
- All Implemented Interfaces:
Signer
The SM9 identity-based digital signature algorithm (GM/T 0044.2-2016).
For signing, initialise with an SM9SigPrivateKeyParameters (optionally
wrapped in ParametersWithRandom). For verifying, initialise with an
SM9SigMasterPublicKeyParameters wrapped in a ParametersWithID
carrying the signer's identity.
The produced signature is encoded as h (32 bytes, big-endian) followed by the uncompressed encoding of the G1 point S (0x04 || x || y).
-
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.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.
-
Constructor Details
-
SM9Signer
public SM9Signer()
-
-
Method Details
-
init
Description copied from interface:SignerInitialise the signer for signing or verification. -
update
-
update
-
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:
CryptoException
-
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
-