wireguard

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const F_GenKey = "wggenkey"
View Source
const F_PubKey = "wgpublickey"
View Source
const KeyLen = 32 // wgh.KeyLen

KeyLen is the expected key length for a WireGuard key.

Variables

This section is empty.

Functions

This section is empty.

Types

type Key

type Key [KeyLen]byte

A Key is a public, private, or pre-shared secret key. The Key constructor functions in this package can be used to create Keys suitable for each of these applications.

func GenerateKey

func GenerateKey() (Key, error)

GenerateKey generates a Key suitable for use as a pre-shared secret key from a cryptographically safe source.

The output Key should not be used as a private key; use GeneratePrivateKey instead.

func GeneratePrivateKey

func GeneratePrivateKey() (Key, error)

GeneratePrivateKey generates a Key suitable for use as a private key from a cryptographically safe source.

func NewKey

func NewKey(b []byte) (Key, error)

NewKey creates a Key from an existing byte slice. The byte slice must be exactly 32 bytes in length.

func ParseKey

func ParseKey(s string) (Key, error)

ParseKey parses a Key from a base64-encoded string, as produced by the Key.String method.

func (Key) PublicKey

func (k Key) PublicKey() Key

PublicKey computes a public key from the private key k.

func (Key) String

func (k Key) String() string

String returns the base64-encoded string representation of a Key. Result can be parsed by ParseKey, again

Jump to

Keyboard shortcuts

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