Top Description Fields Constructors Methods
org.bouncycastle.crypto.signers

public Class SM2Signer

extends Object
implements Signer, ECConstants
Class Inheritance
All Implemented Interfaces
org.bouncycastle.math.ec.ECConstants, org.bouncycastle.crypto.Signer
Imports
java.math.BigInteger, org.bouncycastle.crypto.CipherParameters, .CryptoException, .CryptoServicesRegistrar, .Digest, .Signer, org.bouncycastle.crypto.digests.SM3Digest, org.bouncycastle.crypto.params.ECDomainParameters, .ECKeyParameters, .ECPrivateKeyParameters, .ECPublicKeyParameters, .ParametersWithID, .ParametersWithRandom, org.bouncycastle.math.ec.ECAlgorithms, .ECConstants, .ECFieldElement, .ECMultiplier, .ECPoint, .FixedPointCombMultiplier, org.bouncycastle.util.BigIntegers, org.bouncycastle.util.encoders.Hex

The SM2 Digital Signature algorithm.

Field Summary

Modifier and TypeField and Description
private final Digest
private ECKeyParameters
private ECDomainParameters
private final DSAEncoding
private final DSAKCalculator
private ECPoint
private byte[]
z

Constructor Summary

AccessConstructor and Description
public
public
SM2Signer(Digest digest)

public
public
SM2Signer(DSAEncoding encoding, Digest digest)

Method Summary

Modifier and TypeMethod and Description
private void
private void
addUserID(Digest digest, byte[] userID)

protected BigInteger
calculateE(BigInteger n, byte[] message)

protected ECMultiplier
private byte[]
public byte[]
generateSignature()

Implements org.bouncycastle.crypto.Signer.generateSignature.

generate a signature for the message we've been loaded with using the key we were initialised with.
private byte[]
getZ(byte[] userID)

public void
init(boolean
true if for signing, false otherwise
forSigning
,
CipherParameters
necessary parameters.
param
)

Implements org.bouncycastle.crypto.Signer.init.

Initialise the signer for signing or verification.
public void
reset()

Implements org.bouncycastle.crypto.Signer.reset.

reset the internal state
public void
update(byte b)

Implements org.bouncycastle.crypto.Signer.update.

update the internal digest with the byte b
public void
update(byte[] in, int off, int len)

Implements org.bouncycastle.crypto.Signer.update.

update the internal digest with the byte array in
public boolean
verifySignature(byte[] signature)

Implements org.bouncycastle.crypto.Signer.verifySignature.

return true if the internal state represents the signature described in the passed in array.
private boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

digestback to summary
private final Digest digest
ecKeyback to summary
private ECKeyParameters ecKey
ecParamsback to summary
private ECDomainParameters ecParams
encodingback to summary
private final DSAEncoding encoding
kCalculatorback to summary
private final DSAKCalculator kCalculator
pubPointback to summary
private ECPoint pubPoint
zback to summary
private byte[] z

Constructor Detail

SM2Signerback to summary
public SM2Signer()
SM2Signerback to summary
public SM2Signer(Digest digest)
SM2Signerback to summary
public SM2Signer(DSAEncoding encoding)
SM2Signerback to summary
public SM2Signer(DSAEncoding encoding, Digest digest)

Method Detail

addFieldElementback to summary
private void addFieldElement(Digest digest, ECFieldElement v)
addUserIDback to summary
private void addUserID(Digest digest, byte[] userID)
calculateEback to summary
protected BigInteger calculateE(BigInteger n, byte[] message)
createBasePointMultiplierback to summary
protected ECMultiplier createBasePointMultiplier()
digestDoFinalback to summary
private byte[] digestDoFinal()
generateSignatureback to summary
public byte[] generateSignature() throws CryptoException

Implements org.bouncycastle.crypto.Signer.generateSignature.

Doc from org.bouncycastle.crypto.Signer.generateSignature.

generate a signature for the message we've been loaded with using the key we were initialised with.

getZback to summary
private byte[] getZ(byte[] userID)
initback to summary
public void init(boolean forSigning, CipherParameters param)

Implements org.bouncycastle.crypto.Signer.init.

Doc from org.bouncycastle.crypto.Signer.init.

Initialise the signer for signing or verification.

Parameters
forSigning:boolean

true if for signing, false otherwise

param:CipherParameters

necessary parameters.

resetback to summary
public void reset()

Implements org.bouncycastle.crypto.Signer.reset.

Doc from org.bouncycastle.crypto.Signer.reset.

reset the internal state

updateback to summary
public void update(byte b)

Implements org.bouncycastle.crypto.Signer.update.

Doc from org.bouncycastle.crypto.Signer.update.

update the internal digest with the byte b

updateback to summary
public void update(byte[] in, int off, int len)

Implements org.bouncycastle.crypto.Signer.update.

Doc from org.bouncycastle.crypto.Signer.update.

update the internal digest with the byte array in

verifySignatureback to summary
public boolean verifySignature(byte[] signature)

Implements org.bouncycastle.crypto.Signer.verifySignature.

Doc from org.bouncycastle.crypto.Signer.verifySignature.

return true if the internal state represents the signature described in the passed in array.

verifySignatureback to summary
private boolean verifySignature(BigInteger r, BigInteger s)