Description Usage Arguments Value Examples
encrypt_object
encrypts a R object as a raw object or a
string and decrypt_object
decrypts a raw object or a
string(encrypted by encrypt_object
)
1 | decrypt_object(object, key = "pass", pkey = NULL)
|
object |
Object to be decrypted |
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' |
A raw object if ascii
is FALSE
. A string if
ascii
is TRUE
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # symmetric case:
temp <- encrypt_object(1:3)
all(
is.raw(temp)
, decrypt_object(temp) == 1:3)
temp <- encrypt_object(iris, ascii = TRUE)
all(
is.character(temp)
, decrypt_object(temp) == iris
, identical(decrypt_object(temp), iris))
rm(temp)
# asymmetric case:
alice <- keypair()
bob <- keypair()
temp <- encrypt_object(1:10, alice$private_key, bob$public_key)
temp2 <- decrypt_object(temp, bob$private_key, alice$public_key)
identical(1:10, temp2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.