ed25519

package
v0.20.2 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2026 License: Apache-2.0 Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ed25519 holds the strict Ed25519 rule of SPEC.md section 6.2 (Strict verification) for the new verifier: CheckKeyBytes, the checks of a key's bytes (this file), and Verify, Verify(A, msg, S), which makes them and then calls Go's crypto/ed25519 (verify.go).

This file holds the checks of a key's bytes of SPEC.md section 6.2: steps 2 and 3 of Verify(A, msg, S), which a verifier also makes outside Verify, on K at ENVELOPE (SPEC.md section 10.2, step 3), on each key of a keyring it loads (step 0), and on each key event's public_key at DERIVE. Go's crypto/ed25519 makes neither step, so they are made here, before any library is called.

A key is a [32]byte, so a key of any other length cannot be passed; y is compared with p through math/big; and SMALL_ORDER_KEYS is internal/specdata's transcription of spec/small-order-keys.json, which specdata's tests hold to the file.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrYNotBelowP is step 2: y, the key read as a little-endian integer
	// with its highest bit cleared, is not below p = 2^255 - 19.
	ErrYNotBelowP = errors.New("y_not_below_p")
	// ErrSmallOrderKey is step 3: the key is one of SMALL_ORDER_KEYS.
	ErrSmallOrderKey = errors.New("small_order_key")
)

The refusals of the checks of a key's bytes, by the step of SPEC.md section 6.2 that refuses.

View Source
var (
	// ErrNotOnCurve is step 4: no point of the curve has the encoding A.
	ErrNotOnCurve = errors.New("not_on_curve")
	// ErrSNotBelowL is step 5: s is not below L.
	ErrSNotBelowL = errors.New("s_not_below_l")
	// ErrEquation is step 7: the encoding of [s]B - [k]A is not R.
	ErrEquation = errors.New("equation")
)

The refusals of Verify past the checks of a key's bytes, by the step of SPEC.md section 6.2 that refuses.

Functions

func CheckKeyBytes

func CheckKeyBytes(key [32]byte) error

CheckKeyBytes makes steps 2 and 3 of SPEC.md section 6.2 on key, in that order: nil when key passes both, and otherwise ErrYNotBelowP or ErrSmallOrderKey, the first that refuses.

func Verify

func Verify(key [32]byte, message []byte, signature [64]byte) error

Verify is Verify(A, msg, S) of SPEC.md section 6.2: nil when the 64 octets signature verify under the 32-octet public key key over message, and otherwise the refusal of the first step that fails: ErrYNotBelowP, ErrSmallOrderKey, ErrNotOnCurve, ErrSNotBelowL or ErrEquation. Every message Truestamp signs is 32 octets (section 4.1), but the rule holds for any.

Types

This section is empty.

Jump to

Keyboard shortcuts

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