Table of Contents

Class SM2Signer

Namespace
Org.BouncyCastle.Crypto.Signers
Assembly
BouncyCastle.Cryptography.dll

The SM2 Digital Signature algorithm.

public class SM2Signer : ISigner
Inheritance
SM2Signer
Implements
Inherited Members

Constructors

SM2Signer()

public SM2Signer()

SM2Signer(IDigest)

public SM2Signer(IDigest digest)

Parameters

digest IDigest

SM2Signer(IDsaEncoding)

public SM2Signer(IDsaEncoding encoding)

Parameters

encoding IDsaEncoding

SM2Signer(IDsaEncoding, IDigest)

public SM2Signer(IDsaEncoding encoding, IDigest digest)

Parameters

encoding IDsaEncoding
digest IDigest

Properties

AlgorithmName

The algorithm name.

public virtual string AlgorithmName { get; }

Property Value

string

Methods

BlockUpdate(byte[], int, int)

Update the signer with a block of bytes.

public virtual void BlockUpdate(byte[] input, int inOff, int inLen)

Parameters

input byte[]

the byte array containing the data.

inOff int

the offset into the byte array where the data starts.

inLen int

the length of the data.

BlockUpdate(ReadOnlySpan<byte>)

Update the signer with a span of bytes.

public virtual void BlockUpdate(ReadOnlySpan<byte> input)

Parameters

input ReadOnlySpan<byte>

the span containing the data.

CalculateE(BigInteger, byte[])

protected virtual BigInteger CalculateE(BigInteger n, byte[] message)

Parameters

n BigInteger
message byte[]

Returns

BigInteger

CreateBasePointMultiplier()

protected virtual ECMultiplier CreateBasePointMultiplier()

Returns

ECMultiplier

GenerateSignature()

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

public virtual byte[] GenerateSignature()

Returns

byte[]

A byte array containing the signature for the message.

GetMaxSignatureSize()

public virtual int GetMaxSignatureSize()

Returns

int

Init(bool, ICipherParameters)

Initialise the signer for signing or verification.

public virtual void Init(bool forSigning, ICipherParameters parameters)

Parameters

forSigning bool

true if for signing, false otherwise.

parameters ICipherParameters

necessary parameters.

Reset()

Reset the signer back to its initial state.

public virtual void Reset()

Update(byte)

Update the signer with a single byte.

public virtual void Update(byte b)

Parameters

b byte

VerifySignature(byte[])

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

public virtual bool VerifySignature(byte[] signature)

Parameters

signature byte[]

an array containing the candidate signature to verify.

Returns

bool

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