alg_ecdsa

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: MIT Imports: 10 Imported by: 3

Documentation

Overview

Package alg_ecdsa provides a signers and verifiers for ecdsa-p256-sha256 and ecdsa-p384-sha384

Index

Constants

View Source
const P256_SHA256 = `ecdsa-p256-sha256`
View Source
const P384_SHA384 = `ecdsa-p384-sha384`

Variables

This section is empty.

Functions

This section is empty.

Types

type P256

type P256 struct {
	PrivateKey *ecdsa.PrivateKey
	PublicKey  *ecdsa.PublicKey
	Attrs      any
}

func NewP256Signer

func NewP256Signer(key *ecdsa.PrivateKey) *P256

NewP256Signer returns a signing algorithm based on the provided ecdsa private key.

func NewP256Verifier

func NewP256Verifier(key *ecdsa.PublicKey) *P256

NewP256Verifier returns a verification algorithm based on the provided ecdsa public key.

func (P256) Attributes

func (a P256) Attributes() any

Attributes returns server-side attributes associated with the key.

func (P256) ContentDigest

func (a P256) ContentDigest() contentdigest.Digester

func (P256) Sign

func (a P256) Sign(ctx context.Context, base string) ([]byte, error)

func (P256) Type

func (a P256) Type() string

func (P256) Verify

func (a P256) Verify(ctx context.Context, base string, signature []byte) error

type P384 added in v0.2.0

type P384 struct {
	PrivateKey *ecdsa.PrivateKey
	PublicKey  *ecdsa.PublicKey
	Attrs      any
}

func NewP384Signer added in v0.2.0

func NewP384Signer(key *ecdsa.PrivateKey) *P384

NewP384Signer returns a signing algorithm based on the provided ecdsa private key.

func NewP384Verifier added in v0.2.0

func NewP384Verifier(key *ecdsa.PublicKey) *P384

NewP384Verifier returns a verification algorithm based on the provided ecdsa public key.

func (P384) Attributes added in v0.2.0

func (a P384) Attributes() any

Attributes returns server-side attributes associated with the key.

func (P384) ContentDigest added in v0.2.0

func (a P384) ContentDigest() contentdigest.Digester

func (P384) Sign added in v0.2.0

func (a P384) Sign(ctx context.Context, base string) ([]byte, error)

func (P384) Type added in v0.2.0

func (a P384) Type() string

func (P384) Verify added in v0.2.0

func (a P384) Verify(ctx context.Context, base string, signature []byte) error

type P384StaticKeyDirectory added in v0.2.0

type P384StaticKeyDirectory struct {
	Key        *ecdsa.PublicKey
	Attributes any
}

P384StaticKeyDirectory implements the verifier.KeyDirectory interface for ECDSA P384 keys. It returns a static key regardless of the provided Key ID argument.

func (P384StaticKeyDirectory) GetKey added in v0.2.0

type StaticKeyDirectory

type StaticKeyDirectory struct {
	Key        *ecdsa.PublicKey
	Attributes any
}

StaticKeyDirectory implements the verifier.KeyDirectory interface for ECDSA P256 keys. It returns a static key regardless of the provided Key ID argument.

func (StaticKeyDirectory) GetKey

Jump to

Keyboard shortcuts

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