sw

package
v0.0.0-...-50fbe42 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package sw implements ECDH in pure software / Go

Index

Constants

This section is empty.

Variables

View Source
var (
	P256 = &DH{ecdh.P256()}
	P384 = &DH{ecdh.P384()}
	P521 = &DH{ecdh.P521()}

	ErrInvalidPublicKeyType = errors.New("invalid public key type")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Curve  ecdh.Curve
	Random io.Reader
}

type DH

type DH struct {
	// contains filtered or unexported fields
}

func (*DH) GenerateKeypair

func (dh *DH) GenerateKeypair(rng io.Reader) (dh.Keypair, error)

func (*DH) ParsePrivateKey

func (dh *DH) ParsePrivateKey(data []byte) (dh.Keypair, error)

func (*DH) ParsePublicKey

func (dh *DH) ParsePublicKey(data []byte) (dh.PublicKey, error)

func (*DH) Size

func (dh *DH) Size() (l int)

func (*DH) String

func (dh *DH) String() string

type PrivateKey

type PrivateKey struct {
	*ecdh.PrivateKey
}

func GeneratePrivateKey

func GeneratePrivateKey(cfg Config) (*PrivateKey, error)

func LoadPrivateKey

func LoadPrivateKey(cfg Config, k []byte) (*PrivateKey, error)

func (*PrivateKey) DH

func (kp *PrivateKey) DH(pk dh.PublicKey) ([]byte, error)

func (*PrivateKey) DropPrivate

func (kp *PrivateKey) DropPrivate()

func (*PrivateKey) MarshalBinary

func (kp *PrivateKey) MarshalBinary() ([]byte, error)

func (*PrivateKey) Public

func (kp *PrivateKey) Public() dh.PublicKey

func (*PrivateKey) UnmarshalBinary

func (kp *PrivateKey) UnmarshalBinary(data []byte) error

Jump to

Keyboard shortcuts

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