Perform encryption/decryption
Encrypt plain text into ciphertext, or the reverse
encrypt(text, key, encode = TRUE, ...) decrypt(text, key, encode = TRUE, ...) reencrypt(text, key, encode = TRUE, ...)
text |
For |
key |
A character string specifying a key ID, Amazon Resource Name (ARN), alias name, or alias ARN. When using an alias name, prefix it with “alias/”. |
encode |
A logical specifying whether to base 64 encode |
... |
Additional arguments passed to |
encrypt
encrypts source text using a KMS key. decrypt
reverses this process using the same key. reencrypt
reencrypts an (encrypted) ciphertext using a new key. The purpose of these functions, according to AWS, to is encrypt and decrypt data keys (of the source created with generate_data_key
) rather than general purpose encryption given the relatively low upper limit on the size of text
.
encrypt
returns a base64-encoded binary object as a character string.
## Not run: # create a key k <- create_kms_key() # encrypt tmp <- tempfile() cat("example test", file = tmp) (etext <- encrypt(tmp, k)) # decrypt (dtext <- decrypt(etext, k, encode = FALSE)) if (require("base64enc")) { rawToChar(base64enc::base64decode(dtext)) } # cleanup delete_kms_key(k) ## End(Not run)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.