Top Description Inners 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.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final Digest
private ECKeyParameters
private ECDomainParameters
private final DSAEncoding
private final DSAKCalculator
private ECPoint
private int
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)

private void
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
stateback to summary
private int state
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)
checkDataback to summary
private void checkData()
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)
org.bouncycastle.crypto.signers back to summary

private final Class SM2Signer.State

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv static final int
pack-priv static final int
pack-priv static final int

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DATAback to summary
pack-priv static final int DATA
INITback to summary
pack-priv static final int INIT
UNINITIALIZEDback to summary
pack-priv static final int UNINITIALIZED

Constructor Detail

Stateback to summary
private State()