crypt

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2022 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecryptVerify

func DecryptVerify(
	decryptConfig *DecryptConfig,
	verifyConfig *VerifyConfig,

	cyphertext []byte,
) ([]byte, bool, error)

DecryptVerify decrypts/verified plaintext

func EncryptSign

func EncryptSign(
	encryptConfig *EncryptConfig,
	signatureConfig *SignatureConfig,

	plaintext []byte,
) ([]byte, []byte, error)

EncryptSign encrypts/signs plaintext

func GenerateKey

func GenerateKey(
	fullName string,
	email string,
	password string,
) ([]byte, error)

GenerateKey generates a PGP key using x25519

func IsKeyLocked

func IsKeyLocked(key []byte) (bool, string, error)

IsKeyLocked tests if a key is locked (i.e. if it is password protected)

func ReadKey

func ReadKey(key []byte, password string) (*openpgp.Entity, string, error)

ReadKey parses a PGP key and unlocks it with a password, which may be empty if the key does not need to be unlocked

func Unarmor

func Unarmor(data []byte) ([]byte, error)

Unarmor armors data if it is armored

Types

type DecryptConfig

type DecryptConfig struct {
	PrivateKey *openpgp.Entity // The PGP private key
}

DecryptConfig provides the information to decrypt something

type EncryptConfig

type EncryptConfig struct {
	PublicKey       *openpgp.Entity // The PGP public key
	ArmorCyphertext bool            // Enables armoring the cyphertext
}

EncryptConfig provides the information to encrypt something

type SignatureConfig

type SignatureConfig struct {
	PrivateKey      *openpgp.Entity // The PGP private key
	ArmorSignature  bool            // Enables armoring the signature
	DetachSignature bool            // Enables creating a detached signature
}

SignatureConfig provides the information to sign something

type VerifyConfig

type VerifyConfig struct {
	PublicKey         *openpgp.Entity // The PGP public key
	DetachedSignature []byte          // The detached signature to use (may also be armored)
}

VerifyConfig provides the information to verify something

Jump to

Keyboard shortcuts

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