x25519

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: MIT Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KeyPair

type KeyPair struct {
	PublicKey  PublicKey
	PrivateKey PrivateKey
}

KeyPair represents a public/private key pair.

func GenerateKey

func GenerateKey() (*KeyPair, error)

GenerateKey generates a new X25519 key pair.

type PrivateKey

type PrivateKey []byte

func DecodePrivateKey

func DecodePrivateKey(key string) (PrivateKey, error)

DecodePrivateKey return the PrivateKey decoded from the hexadecimal encoding.

func (*PrivateKey) Encode

func (k *PrivateKey) Encode() string

Encode returns the hexadecimal encoding of PrivateKey.

type PublicKey

type PublicKey []byte

PublicKey represents a public key.

func DecodePublicKey

func DecodePublicKey(key string) (PublicKey, error)

DecodePublicKey return the PublicKey decoded from the hexadecimal encoding.

func PublicFromPrivate

func PublicFromPrivate(privateKey PrivateKey) (PublicKey, error)

PublicFromPrivate returns the public key corresponding to the given private key.

func (*PublicKey) Encode

func (k *PublicKey) Encode() string

Encode returns the hexadecimal encoding of PublicKey.

type SharedSecret

type SharedSecret []byte

SharedSecret represents a shared secret.

func ComputeSharedSecret

func ComputeSharedSecret(outPrivate PrivateKey, theirPublic PublicKey) (SharedSecret, error)

ComputeSharedSecret returns a shared secret between the two given keys.

func (*SharedSecret) Encode

func (s *SharedSecret) Encode() string

Encode returns the hexadecimal encoding of SharedSecret.

Jump to

Keyboard shortcuts

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