Encrypt strings using age

Description

Encrypts one or more strings using the age encryption tool. Can encrypt with public keys (for key-based encryption) or with a passphrase (when no public keys provided). If no public keys are specified, will prompt for a passphrase interactively.

Usage

string_encrypt(input = NULL, public = NULL, armor = FALSE)

Arguments

input Character vector of strings to encrypt
public Character vector of age public keys (recipients). If NULL, will use passphrase encryption and prompt for password.
armor Logical, whether to use ASCII armor format (only applies to public key encryption)

Value

Character vector of encrypted strings

Examples

library("lockbox")

# Encrypt with public key
encrypted <- string_encrypt(c("secret1", "secret2"), public = "age1xyz...")

# Encrypt with passphrase (will prompt)
encrypted <- string_encrypt("my secret")

# Encrypt with armor
encrypted <- string_encrypt("secret", public = "age1xyz...", armor = TRUE)