package ed25519
import "github.com/ProtonMail/go-crypto/openpgp/ed25519"
Package ed25519 implements the ed25519 signature algorithm for OpenPGP as defined in the Open PGP crypto refresh.
Index ¶
- Constants
- func ReadSignature(reader io.Reader) ([]byte, error)
- func Sign(priv *PrivateKey, message []byte) ([]byte, error)
- func Validate(priv *PrivateKey) error
- func Verify(pub *PublicKey, message []byte, signature []byte) bool
- func WriteSignature(writer io.Writer, signature []byte) error
- type PrivateKey
- func GenerateKey(rand io.Reader) (*PrivateKey, error)
- func NewPrivateKey(key PublicKey) *PrivateKey
- func (pk *PrivateKey) MarshalByteSecret() []byte
- func (pk *PrivateKey) Seed() []byte
- func (sk *PrivateKey) UnmarshalByteSecret(seed []byte) error
- type PublicKey
Constants ¶
const ( // PublicKeySize is the size, in bytes, of public keys in this package. PublicKeySize = ed25519lib.PublicKeySize // SeedSize is the size, in bytes, of private key seeds. // The private key representation used by RFC 8032. SeedSize = ed25519lib.SeedSize // SignatureSize is the size, in bytes, of signatures generated and verified by this package. SignatureSize = ed25519lib.SignatureSize )
Functions ¶
func ReadSignature ¶
ReadSignature decodes an ed25519 signature from a reader.
func Sign ¶
func Sign(priv *PrivateKey, message []byte) ([]byte, error)
Sign signs a message with the ed25519 algorithm. priv MUST be a valid key! Check this with Validate() before use.
func Validate ¶
func Validate(priv *PrivateKey) error
Validate checks if the ed25519 private key is valid.
func Verify ¶
Verify verifies an ed25519 signature.
func WriteSignature ¶
WriteSignature encodes and writes an ed25519 signature to writer.
Types ¶
type PrivateKey ¶
type PrivateKey struct { PublicKey // Key the private key representation by RFC 8032, // encoded as seed | pub key point. Key []byte }
func GenerateKey ¶
func GenerateKey(rand io.Reader) (*PrivateKey, error)
GenerateKey generates a fresh private key with the provided randomness source.
func NewPrivateKey ¶
func NewPrivateKey(key PublicKey) *PrivateKey
NewPrivateKey creates a new empty private key referencing the public key.
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
Seed returns the ed25519 private key secret seed. The private key representation by RFC 8032.
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 represents the elliptic curve point of the public key. Point []byte }
func NewPublicKey ¶
func NewPublicKey() *PublicKey
NewPublicKey creates a new empty ed25519 public key.
Source Files ¶
- Version
- v1.3.0 (latest)
- Published
- May 22, 2025
- Platform
- linux/amd64
- Imports
- 4 packages
- Last checked
- 2 days ago –
Tools for package owners.