ecdsa

package
v2.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package ecdsa provides internal ECDSA utility functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ASN1Encode

func ASN1Encode(s *Signature) ([]byte, error)

ASN1Encode encodes the given ECDSA signature using ASN.1 encoding.

func IEEEP1363Encode

func IEEEP1363Encode(sig *Signature, curveName string) ([]byte, error)

IEEEP1363Encode converts the signature to the IEEE_P1363 encoding format.

Types

type Signature

type Signature struct {
	R, S *big.Int
}

Signature is an ECDSA signature.

func ASN1Decode

func ASN1Decode(b []byte) (*Signature, error)

ASN1Decode verifies the given ECDSA signature and decodes it if it is valid.

Since asn1.Unmarshal() doesn't do a strict verification on its input, it will accept signatures with trailing data. Thus, we add an additional check to make sure that the input follows strict DER encoding: after unmarshalling the signature bytes, we marshal the obtained signature object again. Since DER encoding is deterministic, we expect that the obtained bytes would be equal to the input.

func IEEEP1363Decode

func IEEEP1363Decode(encodedBytes []byte) (*Signature, error)

IEEEP1363Decode decodes the given ECDSA signature using IEEE_P1363 encoding.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL