File-to-file encryption. Large files are streamed in constant memory in C (they are not loaded into an R vector).
Usage
age_encrypt_file(
input,
output = NULL,
recipients,
armor = FALSE,
overwrite = FALSE
)
age_decrypt_file(input, output = NULL, identities, overwrite = FALSE)Arguments
- input
Path to the source file.
- output
Destination path. If
NULL(default),age_encrypt_file()appends.agetoinput;age_decrypt_file()strips a trailing.age. Ifinputdoes not end in.age,age_decrypt_file()requiresoutputto be given explicitly rather than guess.- recipients
Character vector of
"age1..."recipient strings.- armor
If
TRUE, produce ASCII-armored output.- overwrite
If
FALSE(default), error whenoutputalready exists.- identities
An
age_identity, or character input accepted byage_identity().
Examples
id <- age_keygen()
rec <- age_pubkey(id)
f <- tempfile(fileext = ".txt")
writeLines("hello", f)
enc <- age_encrypt_file(f, recipients = rec)
dec <- age_decrypt_file(enc, output = tempfile(), identities = id)
readLines(dec)
#> [1] "hello"