x25519

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: ISC Imports: 2 Imported by: 4

Documentation

Overview

Package x25519 implements ECDHE over curve25519.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidScalar

func ValidScalar(s *Scalar) bool

ValidScalar returns whether a secret X25519 scalar was properly constructed.

Types

type KX

type KX struct {
	Public
	Scalar // secret
}

KX is the client-generated public and secret portions of a key exchange.

func New

func New(rand io.Reader) (*KX, error)

New begins a new key exchange by generating a public and secret value. Public portions must be exchanged between parties to derive a shared secret key.

func (*KX) SharedKey

func (kx *KX) SharedKey(theirPublic *Public) ([]byte, error)

SharedKey computes a shared key with the other party from our secret value and their public value. The result should be securely hashed before usage.

type Public

type Public [32]byte

type Scalar

type Scalar [32]byte

Jump to

Keyboard shortcuts

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