Documentation ¶
Overview ¶
Package ed25519-recovery implements a modified Ed25519 signature algorithm that allows for public key recovery. See https://github.com/spacemeshos/ed25519-recovery#readme.
Index ¶
Constants ¶
const ( // PublicKeySize is the size, in bytes, of public keys as used in this package. PublicKeySize = ed25519.PublicKeySize // PrivateKeySize is the size, in bytes, of private keys as used in this package. PrivateKeySize = ed25519.PrivateKeySize // SignatureSize is the size, in bytes, of signatures generated and verified by this package. SignatureSize = ed25519.SignatureSize // SeedSize is the size, in bytes, of private key seeds. These are the private key representations used by RFC 8032. SeedSize = ed25519.SeedSize )
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 InvertModL ¶
func InvertModL(x *edwards25519.Scalar) *edwards25519.Scalar
InvertModL computes 1/x mod l and puts the result into s
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.
The signature may be verified using this package's Verify function if the signer's public key is known.
Note: This function is not compatible with "crypto/ed25519".Sign. The signatures generated by this function cannot be verified using "crypto/ed25519".Verify.
func Verify ¶
Verify reports whether sig is a valid signature of message by publicKey. It will panic if len(publicKey) is not PublicKeySize.
Note: This function is not compatible with "crypto/ed25519".Verify. Only signatures created by this package's Sign function can be verified using this function.
Types ¶
type PrivateKey ¶
type PrivateKey = ed25519.PrivateKey
PrivateKey is the type of Ed25519 private keys. It implements crypto.Signer.
func NewKeyFromSeed ¶
func NewKeyFromSeed(seed []byte) PrivateKey
NewKeyFromSeed calculates a private key from a seed. It will panic if len(seed) is not SeedSize. This function is provided for interoperability with RFC 8032. RFC 8032's private keys correspond to seeds in this package.
type PublicKey ¶
PublicKey is the type of Ed25519 public keys.
func ExtractPublicKey ¶
ExtractPublicKey extracts the signer's public key given a message and its signature. It will panic if len(sig) is not SignatureSize.
Note: This function is not compatible with signatures created by "crypto/ed25519".Sign. Only signatures created by this package's Sign function can be used for public key recovery.
Directories ¶
Path | Synopsis |
---|---|
internal
|
|
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. |