An ECDSA signature.

Fields

r: Curve.scalar.CompressedScalar,

The R component of an ECDSA signature.

s: Curve.scalar.CompressedScalar,

The S component of an ECDSA signature.

Functions

fn fromBytes(bytes: [encoded_length]u8) Signature

Create a signature from a raw encoding of (r, s). ECDSA always assumes big-endi…

Create a signature from a raw encoding of (r, s). ECDSA always assumes big-endian.

fn fromDer(der: []const u8) EncodingError!Signature

Create a signature from a DER representation. Returns InvalidEncoding if the DE…

Create a signature from a DER representation. Returns InvalidEncoding if the DER encoding is invalid.

fn toBytes(self: Signature) [encoded_length]u8

Return the raw signature (r, s) in big-endian format.

fn toDer(self: Signature, buf: *[der_encoded_max_length]u8) []u8

Encode the signature using the DER format. The maximum length of the DER encodi…

Encode the signature using the DER format. The maximum length of the DER encoding is der_encoded_max_length. The function returns a slice, that can be shorter than der_encoded_max_length.

fn verifier(self: Signature, public_key: PublicKey) NonCanonicalError || EncodingError || IdentityElementError!Verifier

Create a Verifier for incremental verification of a signature.

fn verify(self: Signature, msg: []const u8, public_key: PublicKey) IdentityElementError || NonCanonicalError || SignatureVerificationError!void

Verify the signature against a message and public key. Return IdentityElement o…

Verify the signature against a message and public key. Return IdentityElement or NonCanonical if the public key or signature are not in the expected range, or SignatureVerificationError if the signature is invalid for the given message and key.

Values

der_encoded_max_length
type

Maximum length (in bytes) of a DER-encoded signature.

encoded_length
type

Length (in bytes) of a raw signature.