key

package
v1.14.3 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2021 License: BSD-3-Clause Imports: 7 Imported by: 115

Documentation

Overview

Package key defines some types related to curve25519 keys.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Private

type Private [32]byte

Private represents a curve25519 private key.

func NewPrivate added in v0.100.0

func NewPrivate() Private

NewPrivate returns a new private key.

func (Private) B32

func (k Private) B32() *[32]byte

B32 returns k as the *[32]byte type that's used by the golang.org/x/crypto packages. This allocates; it might not be appropriate for performance-sensitive paths.

func (Private) IsZero

func (p Private) IsZero() bool

Private reports whether p is the zero value.

func (Private) Public

func (k Private) Public() Public

func (Private) SharedSecret added in v1.4.0

func (k Private) SharedSecret(pub Public) (ss [32]byte)

type Public

type Public [32]byte

Public represents a curve25519 public key.

func NewPublicFromHexMem added in v0.98.0

func NewPublicFromHexMem(m mem.RO) (Public, error)

NewPublicFromHexMem parses a public key in its hex form, given in m. The provided m must be exactly 64 bytes in length.

func (Public) B32

func (k Public) B32() *[32]byte

B32 returns k as the *[32]byte type that's used by the golang.org/x/crypto packages. This allocates; it might not be appropriate for performance-sensitive paths.

func (Public) IsZero

func (p Public) IsZero() bool

Public reports whether p is the zero value.

func (Public) MarshalText added in v0.98.0

func (p Public) MarshalText() ([]byte, error)

func (Public) ShortString added in v0.98.0

func (p Public) ShortString() string

ShortString returns the Tailscale conventional debug representation of a public key: the first five base64 digits of the key, in square brackets.

func (*Public) UnmarshalText added in v0.98.0

func (p *Public) UnmarshalText(txt []byte) error

Jump to

Keyboard shortcuts

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