ecdsa

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package ecdsa implements signature algorithm ECDSA for COSE as defined in RFC9053. https://datatracker.ietf.org/doc/html/rfc9053#name-ecdsa.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckKey

func CheckKey(k key.Key) error

CheckKey checks whether the given key is a valid ECDSA key.

func DecodeSignature

func DecodeSignature(curve elliptic.Curve, sig []byte) (r, s *big.Int, err error)

DecodeSignature decodes (r, s) from a signature bytes using the method specified by RFC 8152 section 8.1.

func EncodeSignature

func EncodeSignature(curve elliptic.Curve, r, s *big.Int) ([]byte, error)

EncodeSignature encodes (r, s) into a signature bytes using the method specified by RFC 8152 section 8.1.

func GenerateKey

func GenerateKey(alg int) (key.Key, error)

GenerateKey generates a new Key with given algorithm for ECDSA. alg is one of the iana.AlgorithmES* constants.

func KeyFromPrivate

func KeyFromPrivate(pk *goecdsa.PrivateKey) (key.Key, error)

KeyFromPrivate returns a private Key with given ecdsa.PrivateKey.

func KeyFromPublic

func KeyFromPublic(pk *goecdsa.PublicKey) (key.Key, error)

KeyFromPublic returns a public Key with given ecdsa.PublicKey.

func KeyToPrivate added in v0.5.0

func KeyToPrivate(k key.Key) (*goecdsa.PrivateKey, error)

KeyToPrivate returns a ecdsa.PrivateKey for the given Key.

func KeyToPublic added in v0.5.0

func KeyToPublic(k key.Key) (*goecdsa.PublicKey, error)

KeyToPublic returns a ecdsa.PublicKey for the given key.Key.

func NewSigner

func NewSigner(k key.Key) (key.Signer, error)

NewSigner creates a key.Signer for the given private key.

func NewVerifier

func NewVerifier(k key.Key) (key.Verifier, error)

NewVerifier creates a key.Verifier for the given public key.

func ToCompressedKey added in v0.5.0

func ToCompressedKey(k key.Key) (key.Key, error)

ToCompressedKey converts the given key to a compressed Key. It can be used in Recipient.

func ToPublicKey

func ToPublicKey(k key.Key) (key.Key, error)

ToPublicKey converts the given private key to a public key. If the key is already a public key, it is returned as-is.

Types

This section is empty.

Jump to

Keyboard shortcuts

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