rcloud.read.pem {rcloud.support} | R Documentation |
rcloud.read.pem
reads content in PEM (Privacy Encanced Mail)
format into an object that can be typically passed to
rcloud.decrypt()
.
rcloud.write.pem
writes encrypted object in PEM format which
is text-only and can be easily transported via non-binary media such
as copy/paste or e-mails.
rcloud.read.pem(file)
rcloud.write.pem(x, file, append=FALSE)
x |
item to store |
file |
either a connection or a string specifying a file name |
append |
logical, only used if |
rcloud.read.pem
reads from a file or connection until it
finds RCLOUD CONTENT
PEM section. Then it decodes the
section and returns the object. All headers starting with
Meta-
are stored in the "metadata"
attribute. If an
open connection was passed then the reading is advanced just past
the parsed section so further processing is possible (e.g., multiple
sections are be parsed by repeated calls to rcloud.read.pem
).
If the connection was not open, it will be opened and closed for the
duration of the call, i.e., only the first section is returned.
rcloud.write.pem
writes the object in PEM format using
RCLOUD CONTENT
section. Entries from the "metadata"
attribute are stored as headers with Meta-
prefix. If
file
is not open connection then it will be opened for
writing and then closed upon completion.
rcloud.read.pem
returns TRUE
invisibly on success
rcloud.write.pem
returns the decoded raw object
Simon Urbanek
a <- 1:10
key <- PKI::PKI.genRSAkey(2048)
enc <- rcloud.encrypt(a, key)
## show the encrypted object
str(enc)
## write in PEM format
rcloud.write.pem(enc, "test.pem")
## show the output
writeLines(readLines("test.pem"))
## read and decrypt
rcloud.decrypt(rcloud.read.pem("test.pem"), key)
## NOTE: you can use RCloud-managed keys
## in which case you don't need to supply the key
## - see ?rcloud.encrypt
unlink("test.pem")