Curvy.Signature (Curvy v0.2.2) View Source

Module for converting signature R and S values to DER encoded or compact binaries.

Link to this section Summary

Types

Recovery ID

t()

ECDSA Signature

Functions

Normalizes the signature by enforcing Low-S values.

Parsed the given binary signature in a Signature struct.

Returns the signature as a 65 byte compact binary.

Returns the signature as a DER-encoded binary.

Link to this section Types

Specs

recovery_id() :: 0 | 1 | 2 | 3

Recovery ID

Specs

t() :: %Curvy.Signature{
  crv: atom(),
  r: integer(),
  recid: recovery_id() | nil,
  s: integer()
}

ECDSA Signature

Link to this section Functions

Specs

normalize(t()) :: t()

Normalizes the signature by enforcing Low-S values.

Returns a Signature.

See BIP 62 for more info.

Specs

parse(binary()) :: t() | :error

Parsed the given binary signature in a Signature struct.

Parsed DER encoded and compact signatures. Returns :error if unable to parse.

Link to this function

to_compact(signature, opts \\ [])

View Source

Specs

to_compact(t(), keyword()) :: binary()

Returns the signature as a 65 byte compact binary.

Link to this function

to_der(signature, opts \\ [])

View Source

Returns the signature as a DER-encoded binary.