encrypt: Save an encrypted RDS

View source: R/encrypt.R

encryptR Documentation

Save an encrypted RDS

Description

Save an encrypted RDS

Usage

encrypt(robj, dst = NULL, key, additional_data = NULL, compress = "none")

Arguments

robj

R object

dst

Either a filename or NULL. Default: NULL write results to a raw vector

key

The encryption key. This may be a character string, a 32-byte raw vector or a 64-character hex string (which encodes 32 bytes). When a shorter character string is given, a 32-byte key is derived using the Argon2 key derivation function.

additional_data

Additional data to include in the authentication. Raw vector or character string. Default: NULL. This additional data is not included with the encrypted data, but represents an essential component of the message authentication. The same additional_data must be presented during both encryption and decryption for the message to be authenticated. See vignette on 'Additional Data'.

compress

compression type. Default: 'none'. Valid values are any of the accepted compression types for R memCompress()

Value

Raw vector containing encrypted object written to file or returned

Examples

key <- argon2('my key')
encrypt(mtcars, key = key) |> 
  decrypt(key = key)

rmonocypher documentation built on April 4, 2025, 4:41 a.m.