crypto

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(ciphertext []byte, identity age.Identity) ([]byte, error)

Decrypt decrypts ciphertext using the given age identity (private key).

func DecryptWithPassphrase

func DecryptWithPassphrase(ciphertext []byte, passphrase string) ([]byte, error)

DecryptWithPassphrase decrypts data encrypted with a passphrase.

func DeleteKey

func DeleteKey() error

DeleteKey removes the age private key from the OS keychain.

func Encrypt

func Encrypt(plaintext []byte, recipient age.Recipient) ([]byte, error)

Encrypt encrypts plaintext using the given age public key (recipient).

func EncryptWithPassphrase

func EncryptWithPassphrase(plaintext []byte, passphrase string) ([]byte, error)

EncryptWithPassphrase encrypts data using a passphrase (for key backup).

func GenerateKey

func GenerateKey() (*age.X25519Identity, error)

GenerateKey creates a new age X25519 identity (keypair).

func LoadKey

func LoadKey() (*age.X25519Identity, string, error)

LoadKey retrieves the age private key, trying (in order): 1. ENCLAUDE_KEY environment variable 2. OS keychain Returns the identity and the source it was loaded from.

func LoadPublicKey

func LoadPublicKey() (*age.X25519Recipient, string, error)

LoadPublicKey loads just the public key (for encryption-only operations like seal).

func ParseIdentity

func ParseIdentity(secretKey string) (*age.X25519Identity, error)

ParseIdentity parses an age secret key string into an Identity.

func ParseRecipient

func ParseRecipient(publicKey string) (*age.X25519Recipient, error)

ParseRecipient parses an age public key string into a Recipient.

func ShredFile

func ShredFile(path string) error

ShredFile overwrites a file with random data before deleting it. This provides better-than-nothing protection on HDDs. On SSDs with TRIM, this is less effective but still removes the plaintext file.

func StoreKey

func StoreKey(identity *age.X25519Identity) error

StoreKey saves the age private key to the OS keychain.

Types

This section is empty.

Jump to

Keyboard shortcuts

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