Documentation ¶
Overview ¶
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
- 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 )
Variables ¶
This section is empty.
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.
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.