【发布时间】:2022-01-13 17:20:48
【问题描述】:
我有一个闪亮的应用程序,我想将用户数据存储在服务器上,并希望在存储之前对其进行加密。我想为此使用encryptr 包,但到目前为止我无法使我的解决方案正常工作。到目前为止,我管理的是将数据写入 rds 文件,然后对其进行加密并删除未加密的副本。但是,理想情况下,我只想存储加密文件。但是,当我再次尝试解密时,文件根本没有改变。
#### Approach with storing file first (works)
# data
data <- mtcars
# saving file
saveRDS(data,"Example.rds")
# keys
genkeys()
# encrypting
encrypt_file("Example.rds")
# deleting unencrypted copy
file.remove("Example.rds")
# unencrypting file
data_decrypted <- decrypt_file("Example.rds.encryptr.bin")
我想做的是这样的
#### Approach with storing only encrypted file (can't be decrypted again)
# data
data <- mtcars
# keys
genkeys()
# encrypting data
data <- encrypt(colnames(data))
# saving encrypted data
saveRDS(data,"EncryptedData.rds")
# clearing wd
rm(data)
# loading encrypted data
EncryptedData <- readRDS("EncryptedData.rds.encryptr.bin")
# decrypting data
data_decrypted <- decrypt(colnames(EncryptedData))
【问题讨论】:
标签: r encryption shiny rsa