cryptoutil

package
v0.0.0-...-293da44 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const Curve25519KeySize = 32

Curve25519KeySize number of bytes in a Curve25519 public or private key.

View Source
const NonceSize = 24

NonceSize size of a nonce used by Box encryption (Xchacha20Poly1305).

Variables

This section is empty.

Functions

func Derive25519KEK

func Derive25519KEK(alg, apu, apv []byte, fromPrivKey, toPubKey *[chacha.KeySize]byte) ([]byte, error)

Derive25519KEK is a utility function that will derive an ephemeral symmetric key (kek) using fromPrivKey and toPubKey.

func LengthPrefix

func LengthPrefix(array []byte) []byte

LengthPrefix array with a bigEndian uint32 value of array's length.

func Nonce

func Nonce(pub1, pub2 []byte) (*[NonceSize]byte, error)

Nonce makes a nonce using blake2b, to match the format expected by libsodium.

func PublicEd25519toCurve25519

func PublicEd25519toCurve25519(pub []byte) ([]byte, error)

PublicEd25519toCurve25519 takes an Ed25519 public key and provides the corresponding Curve25519 public key This function wraps PublicKeyToCurve25519 from Adam Langley's ed25519 repo: https://github.com/agl/ed25519 now moved to https://github.com/teserakt-io/golang-ed25519

func SecretEd25519toCurve25519

func SecretEd25519toCurve25519(priv []byte) ([]byte, error)

SecretEd25519toCurve25519 converts a secret key from Ed25519 to curve25519 format This function wraps PrivateKeyToCurve25519 from Adam Langley's ed25519 repo: https://github.com/agl/ed25519 now moved to https://github.com/teserakt-io/golang-ed25519

Types

This section is empty.

Jump to

Keyboard shortcuts

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