safer (version 0.1.0)

save_object: Save a R object to a connection

Description

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.

Usage

save_object(object, conn, ascii = FALSE, key = "pass",
  method = "symmetric")

Arguments

object

A R object to be encrypted

conn

A connection or a file where the encrypted content is written. If ascii is TRUE, an encrypted text is written to the connection. Else, when ascii is FALSE(default), a raw object is written to the connection

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)

key

A string without embbeded NULL. Default is 'pass'

method

Currently, a stub. It should be 'symmetric'(default)

Value

An invisible TRUE

Examples

Run this code
# NOT RUN {
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
)

# }

Run the code above in your browser using DataLab