crypto

package
v0.5.8 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package crypto implements basic crypto primitives used in the project

Index

Constants

View Source
const (
	KeyLength = 32
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Key

type Key [KeyLength]byte

func GenerateKey

func GenerateKey() (Key, error)

func GenerateKeyFromPassword

func GenerateKeyFromPassword(pw string) Key

func GeneratePrivateKey

func GeneratePrivateKey() (Key, error)

func ParseKey

func ParseKey(str string) (Key, error)

func ParseKeyBytes

func ParseKeyBytes(buf []byte) (Key, error)

func (Key) Bytes

func (k Key) Bytes() []byte

func (Key) IPAddress

func (k Key) IPAddress(p net.IPNet) net.IPNet

func (Key) IsSet

func (k Key) IsSet() bool

Checks if the key is not zero

func (Key) MarshalText

func (k Key) MarshalText() ([]byte, error)

func (Key) PublicKey

func (k Key) PublicKey() Key

func (Key) String

func (k Key) String() string

func (*Key) UnmarshalText

func (k *Key) UnmarshalText(text []byte) error

type KeyPair

type KeyPair struct {
	Ours   Key `json:"ours"`
	Theirs Key `json:"theirs"`
}

func (KeyPair) Public

func (kp KeyPair) Public() PublicKeyPair

func (KeyPair) Shared

func (kp KeyPair) Shared() Key

type KeyPassphrase

type KeyPassphrase Key

A key which uses GenerateKeyFromPassword() for UnmarshalText()

func (*KeyPassphrase) UnmarshalText

func (k *KeyPassphrase) UnmarshalText(text []byte) error

type Nonce

type Nonce []byte

func GetNonce

func GetNonce(length int) (Nonce, error)

type PublicKeyPair

type PublicKeyPair KeyPair

Jump to

Keyboard shortcuts

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