ed25519

package
v0.0.0-...-5e6eafe Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package ed25519 implements the Ed25519 signature algorithm. See https://ed25519.cr.yp.to/.

These functions are also compatible with the “Ed25519” function defined in RFC 8032. However, unlike RFC 8032's formulation, this package's private key representation includes a public key suffix to make multiple signing operations with the same key more efficient. This package refers to the RFC 8032 private key as the “seed”.

Beginning with Go 1.13, the functionality of this package was moved to the standard library as crypto/ed25519. This package only acts as a compatibility wrapper.

Index

Constants

View Source
const (
	// PublicKeySize is the size, in bytes, of public keys as used in this package.
	PublicKeySize = 32
	// PrivateKeySize is the size, in bytes, of private keys as used in this package.
	PrivateKeySize = 64
	// SignatureSize is the size, in bytes, of signatures generated and verified by this package.
	SignatureSize = 64
	// SeedSize is the size, in bytes, of private key seeds. These are the private key representations used by RFC 8032.
	SeedSize = 32
)

Variables

This section is empty.

Functions

func GenerateKey

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

GenerateKey generates a public/private key pair using entropy from rand. If rand is nil, crypto/rand.Reader will be used.

func Sign

func Sign(privateKey PrivateKey, message []byte) []byte

Sign signs the message with privateKey and returns a signature. It will panic if len(privateKey) is not PrivateKeySize.

func Verify

func Verify(publicKey PublicKey, message, sig []byte) bool

Verify reports whether sig is a valid signature of message by publicKey. It will panic if len(publicKey) is not PublicKeySize.

Types

type PrivateKey

type PrivateKey = ed25519.PrivateKey

PrivateKey is the type of Ed25519 private keys. It implements crypto.Signer.

This type is an alias for crypto/ed25519's PrivateKey type. See the crypto/ed25519 package for the methods on this type.

func NewKeyFromSeed

func NewKeyFromSeed(seed []byte) PrivateKey

type PublicKey

type PublicKey = ed25519.PublicKey

PublicKey is the type of Ed25519 public keys.

This type is an alias for crypto/ed25519's PublicKey type. See the crypto/ed25519 package for the methods on this type.

Directories

Path Synopsis
internal
boring
Package boring provides access to BoringCrypto implementation functions.
Package boring provides access to BoringCrypto implementation functions.
boring/bcache
Package bcache implements a GC-friendly cache (see [Cache]) for BoringCrypto.
Package bcache implements a GC-friendly cache (see [Cache]) for BoringCrypto.
boring/sig
Package sig holds “code signatures” that can be called and will result in certain code sequences being linked into the final binary.
Package sig holds “code signatures” that can be called and will result in certain code sequences being linked into the final binary.
edwards25519
Package edwards25519 implements group logic for the twisted Edwards curve
Package edwards25519 implements group logic for the twisted Edwards curve
edwards25519/field
Package field implements fast arithmetic modulo 2^255-19.
Package field implements fast arithmetic modulo 2^255-19.
nistec
Package nistec implements the NIST P elliptic curves from FIPS 186-4.
Package nistec implements the NIST P elliptic curves from FIPS 186-4.
randutil
Package randutil contains internal randomness utilities for various crypto packages.
Package randutil contains internal randomness utilities for various crypto packages.
subtle
Package subtle implements functions that are often useful in cryptographic code but require careful thought to use correctly.
Package subtle implements functions that are often useful in cryptographic code but require careful thought to use correctly.

Jump to

Keyboard shortcuts

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