org.bouncycastle.jcajce.provider.asymmetric.sm9
Class SignatureSpi
java.lang.Object
java.security.SignatureSpi
org.bouncycastle.jcajce.provider.asymmetric.sm9.SignatureSpi
- public class SignatureSpi
- extends java.security.SignatureSpi
JCA 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 is required - the identity travels in the keys.
| Fields inherited from class java.security.SignatureSpi |
appRandom |
|
Method Summary |
protected java.lang.Object |
engineGetParameter(java.lang.String param)
|
protected java.security.AlgorithmParameters |
engineGetParameters()
SM9 signing takes no algorithm parameters, so there are none to report. |
protected void |
engineInitSign(java.security.PrivateKey privateKey)
|
protected void |
engineInitSign(java.security.PrivateKey privateKey,
java.security.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 void |
engineInitVerify(java.security.PublicKey publicKey)
|
protected void |
engineSetParameter(java.security.spec.AlgorithmParameterSpec params)
|
protected void |
engineSetParameter(java.lang.String param,
java.lang.Object value)
|
protected byte[] |
engineSign()
|
protected void |
engineUpdate(byte b)
|
protected void |
engineUpdate(byte[] bytes,
int off,
int len)
|
protected boolean |
engineVerify(byte[] signature)
|
| Methods inherited from class java.security.SignatureSpi |
clone, engineSign, engineVerify |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SignatureSpi
public SignatureSpi()
engineInitSign
protected void engineInitSign(java.security.PrivateKey privateKey)
throws java.security.InvalidKeyException
- Throws:
java.security.InvalidKeyException
engineInitSign
protected void engineInitSign(java.security.PrivateKey privateKey,
java.security.SecureRandom random)
throws java.security.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.
- Throws:
java.security.InvalidKeyException
engineInitVerify
protected void engineInitVerify(java.security.PublicKey publicKey)
throws java.security.InvalidKeyException
- Throws:
java.security.InvalidKeyException
engineSetParameter
protected void engineSetParameter(java.security.spec.AlgorithmParameterSpec params)
throws java.security.InvalidAlgorithmParameterException
- Throws:
java.security.InvalidAlgorithmParameterException
engineUpdate
protected void engineUpdate(byte b)
throws java.security.SignatureException
- Throws:
java.security.SignatureException
engineUpdate
protected void engineUpdate(byte[] bytes,
int off,
int len)
throws java.security.SignatureException
- Throws:
java.security.SignatureException
engineSign
protected byte[] engineSign()
throws java.security.SignatureException
- Throws:
java.security.SignatureException
engineVerify
protected boolean engineVerify(byte[] signature)
throws java.security.SignatureException
- Throws:
java.security.SignatureException
engineSetParameter
protected void engineSetParameter(java.lang.String param,
java.lang.Object value)
engineGetParameter
protected java.lang.Object engineGetParameter(java.lang.String param)
engineGetParameters
protected java.security.AlgorithmParameters 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.