Class SignatureSpi
java.lang.Object
java.security.SignatureSpi
org.bouncycastle.jcajce.provider.asymmetric.sm9.SignatureSpi
JCA
SM9 signature (GM/T 0044.2). Sign with the private key from
SM9SigUserKeyGenerator.generateUserKeyPair(byte[]);
verify with the signer's public key, formed from the published master public key and
the signer's identity via
SM9SigMasterPublicKey.getUserPublicKey(byte[]).
No AlgorithmParameterSpec is required - the identity travels in the keys.-
Field Summary
Fields inherited from class SignatureSpi
appRandom -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ObjectengineGetParameter(String param) protected AlgorithmParametersSM9 signing takes no algorithm parameters, so there are none to report.protected voidengineInitSign(PrivateKey privateKey) protected voidengineInitSign(PrivateKey privateKey, SecureRandom random) Each init decides afresh where the signing nonce is drawn from: the SecureRandom handed to Signature.initSign(key, random), or the default source for an init given none.protected voidengineInitVerify(PublicKey publicKey) protected voidengineSetParameter(String param, Object value) protected voidprotected byte[]protected voidengineUpdate(byte b) protected voidengineUpdate(byte[] bytes, int off, int len) protected booleanengineVerify(byte[] signature) Methods inherited from class SignatureSpi
clone, engineSign, engineUpdate, engineVerify
-
Constructor Details
-
SignatureSpi
public SignatureSpi()
-
-
Method Details
-
engineInitSign
- Specified by:
engineInitSignin classSignatureSpi- Throws:
InvalidKeyException
-
engineInitSign
protected void engineInitSign(PrivateKey privateKey, SecureRandom random) throws InvalidKeyException Each init decides afresh where the signing nonce is drawn from: the SecureRandom handed to Signature.initSign(key, random), or the default source for an init given none. The random of initSign(key, random) had been read from the appRandom field java.security.SignatureSpi records it in, which nothing resets, so a later initSign(key) went on drawing from the random of the earlier call.- Overrides:
engineInitSignin classSignatureSpi- Throws:
InvalidKeyException
-
engineInitVerify
- Specified by:
engineInitVerifyin classSignatureSpi- Throws:
InvalidKeyException
-
engineSetParameter
protected void engineSetParameter(AlgorithmParameterSpec params) throws InvalidAlgorithmParameterException - Overrides:
engineSetParameterin classSignatureSpi- Throws:
InvalidAlgorithmParameterException
-
engineUpdate
- Specified by:
engineUpdatein classSignatureSpi- Throws:
SignatureException
-
engineUpdate
- Specified by:
engineUpdatein classSignatureSpi- Throws:
SignatureException
-
engineSign
- Specified by:
engineSignin classSignatureSpi- Throws:
SignatureException
-
engineVerify
- Specified by:
engineVerifyin classSignatureSpi- Throws:
SignatureException
-
engineSetParameter
- Specified by:
engineSetParameterin classSignatureSpi
-
engineGetParameter
- Specified by:
engineGetParameterin classSignatureSpi
-
engineGetParameters
SM9 signing takes no algorithm parameters, so there are none to report. Without this override java.security.SignatureSpi's default threw UnsupportedOperationException out of Signature.getParameters(), where the answer BC gives for a parameterless scheme is null.- Overrides:
engineGetParametersin classSignatureSpi
-