ed25519

package
v2.0.0-...-6e5629b Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2023 License: BSD-3-Clause Imports: 4 Imported by: 1

Documentation

Overview

Package ed25519 implements the ed25519 signature algorithm for OpenPGP as defined in the Open PGP crypto refresh.

Index

Constants

View Source
const PointSize = 32
View Source
const PrivateKeySize = 64
View Source
const SignatureSize = 64

Variables

This section is empty.

Functions

func ReadSignature

func ReadSignature(reader io.Reader) ([]byte, error)

func Sign

func Sign(priv *PrivateKey, message []byte) ([]byte, error)

Sign signs a message with the ed25519 algorithm.

func Validate

func Validate(priv *PrivateKey) error

Validate checks if the ed25519 private key is valid

func Verify

func Verify(pub *PublicKey, message []byte, signature []byte) bool

Verify verifies a ed25519 signature

func WriteSignature

func WriteSignature(writer io.Writer, signature []byte) error

Types

type PrivateKey

type PrivateKey struct {
	PublicKey
	Key []byte // encoded as seed | pub key point
}

func GenerateKey

func GenerateKey(rand io.Reader) (*PrivateKey, error)

func NewPrivateKey

func NewPrivateKey(key PublicKey) *PrivateKey

func (*PrivateKey) MarshalByteSecret

func (pk *PrivateKey) MarshalByteSecret() []byte

MarshalByteSecret returns the underlying 32 byte seed of the private key

func (*PrivateKey) Seed

func (pk *PrivateKey) Seed() []byte

func (*PrivateKey) UnmarshalByteSecret

func (sk *PrivateKey) UnmarshalByteSecret(seed []byte) error

UnmarshalByteSecret computes the private key from the secret seed and stores it in the private key object.

type PublicKey

type PublicKey struct {
	Point []byte
}

func NewPublicKey

func NewPublicKey() *PublicKey

Jump to

Keyboard shortcuts

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