keyfile

package
Version: v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2021 License: BlueOak-1.0.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncryptSecretKey

func EncryptSecretKey(rand io.Reader, skw io.Writer, sk *SecretKey, passphrase []byte, kdfp *Argon2idParams, kf Keyfields) error

EncryptSecretKey writes the secret key encrypted in keyfile format to skw.

func GenerateKeys

func GenerateKeys(rand io.Reader, pkw, skw io.Writer, passphrase []byte, kdfp *Argon2idParams, comment string) (fingerprint string, err error)

GenerateKeys generates a random Streamlined NTRU Prime 4591^761 public/secret key pair, writing the public key to pkw and secret key to skw. The secret key is encrypted with ChaCha20-Poly1305 using a symmetric key derived using Argon2id from passphrase and specified KDF parameters. Cryptographically-secure randomness is provided by rand.

func OpenSecretKey

func OpenSecretKey(r io.Reader, passphrase []byte) (_ *SecretKey, _ Keyfields, err error)

OpenSecretKey reads and decrypts an encryted Streamlined NTRU Prime 4591^761 secret key in the keyfile format from r.

Types

type Argon2idParams

type Argon2idParams struct {
	Time   uint32
	Memory uint32
}

Argon2idParams describes the difficulty parameters used when deriving a symmetric encryption key from a passphrase using the Argon2id KDF.

type Keyfields

type Keyfields struct {
	Comment     string
	Fingerprint string
}

Keyfields describes keyfile fields that must be preserved when a key is reencrypted.

type PublicKey

type PublicKey = [ntrup.PublicKeySize]byte

PublicKey is a type alias for a properly-sized byte array to represent a Streamlined NTRU Prime 4591^761 public key.

func ReadPublicKey

func ReadPublicKey(r io.Reader) (*PublicKey, error)

ReadPublicKey reads a Streamlined NTRU Prime 4591^761 public key in the keyfile format from r.

type SecretKey

type SecretKey = [ntrup.PrivateKeySize]byte

SecretKey is a type alias for a properly-sized byte array to represent a Streamlined NTRU Prime 4591^761 secret key.

Source Files

Jump to

Keyboard shortcuts

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