Show / Hide Table of Contents

Class EcdsaSignature

An ECDSA signature and its DER encoding.

Inheritance
object
EcdsaSignature
Namespace: Xrpl.Keypairs.K256
Assembly: Xrpl.Keypairs.dll
Syntax
public class EcdsaSignature

Constructors

| Edit this page View Source

EcdsaSignature(BigInteger, BigInteger)

Constructs a signature with the given components.

Declaration
public EcdsaSignature(BigInteger r, BigInteger s)
Parameters
Type Name Description
BigInteger r
BigInteger s
Exceptions
Type Condition
ArgumentOutOfRangeException

r or s is negative.

Fields

| Edit this page View Source

R

The two components of the signature, non-negative.

Declaration
public BigInteger R
Field Value
Type Description
BigInteger
| Edit this page View Source

S

The two components of the signature, non-negative.

Declaration
public BigInteger S
Field Value
Type Description
BigInteger

Methods

| Edit this page View Source

CheckIsCanonical(byte[], bool)

Whether sig is a canonical DER signature: minimal positive R and S below the curve order, and with strict also S at most n/2.

Declaration
public static bool CheckIsCanonical(byte[] sig, bool strict)
Parameters
Type Name Description
byte[] sig
bool strict
Returns
Type Description
bool
| Edit this page View Source

DecodeFromDer(byte[])

Decodes a DER signature; returns null when the bytes are not exactly one DER SEQUENCE of two INTEGERs in minimal encoding.

Declaration
public static EcdsaSignature DecodeFromDer(byte[] bytes)
Parameters
Type Name Description
byte[] bytes
Returns
Type Description
EcdsaSignature
Remarks

Strict DER, as rippled requires: trailing bytes or a non-minimal length or integer would otherwise decode to a signature that verifies. An INTEGER whose first byte has the high bit set is read as unsigned: OpenSSL reads these values that way, though DER says they are negative (see http://r6.ca/blog/20111119T211504Z.html).

| Edit this page View Source

EncodeToDer()

The DER encoding of the signature: a SEQUENCE of two minimal INTEGERs, as OpenSSL and rippled read it.

Declaration
public byte[] EncodeToDer()
Returns
Type Description
byte[]
| Edit this page View Source

IsStrictlyCanonical(byte[])

Whether sig is a canonical DER signature with a low S, as rippled requires under tfFullyCanonicalSig.

Declaration
public static bool IsStrictlyCanonical(byte[] sig)
Parameters
Type Name Description
byte[] sig
Returns
Type Description
bool
  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX