Description Usage Arguments Value Examples
save_object
encrypts a R object to raw or text connection
or a file. retrieve_object
decrypts a raw or a text connection or a
file (encrypted by save_object
). Note that retrieve_object
returns the object.
1 | retrieve_object(conn, key = "pass", pkey = NULL, ascii = FALSE)
|
conn |
A connection or a file where the decrypted content is written. If
|
key |
For symmetric decryption, 'pkey' should be NULL (default) and 'key' can be either a string (Default is 'pass') or a raw object. For asymmetric decryption, both 'key' (private key of the decrypter) and 'pkey' (public key of the encrypter) should be raw objects. |
pkey |
See 'key' |
ascii |
TRUE, if the encrypted output is a string(written to the text connection). FALSE, if the encrypted output is a raw object(written to the raw connection) |
An invisible TRUE
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # symmetric case:
all(
save_object(iris, conn = "iris_safer.bin")
, identical(retrieve_object(conn = "iris_safer.bin"), iris)
, unlink("iris_safer.bin") == 0
)
all(
save_object(iris, conn = "iris_safer_2.txt", ascii = TRUE)
, identical(retrieve_object(conn = "iris_safer_2.txt", ascii = TRUE), iris)
, unlink("iris_safer_2.txt") == 0
)
# asymmetric case:
alice <- keypair()
bob <- keypair()
all(
save_object(iris, alice$private_key, bob$public_key, conn = "iris_safer.bin")
, identical(retrieve_object(conn = "iris_safer.bin", bob$private_key, alice$public_key), iris)
, unlink("iris_safer.bin") == 0
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.