r - How to save the password in script R in package ‘encryptr’?
问题描述
I do that:
library(encryptr)
genkeys()
And I created the password: 0)]30l^8
password<-"0)]30l^8"
data(gp)
write.csv(gp, "gp.csv")
encrypt_file("gp.csv")
My problem is: How do I automatically enter the password on the decrypt_file("gp.csv.encryptr.bin", file_name = "gp2.csv")
I need this to decrypt many files in a short time.
解决方案
非常感谢这个问题。不建议在脚本中保存密码,因为在大多数情况下这会破坏加密文件的目的。尽管不建议这样做,但您可以解决此有意的功能。
password<-"0)]30l^8"
.crypt = readRDS("gp.csv.encryptr.bin") # in file
zz = file("gp2.csv", "wb") # out file
openssl::decrypt_envelope(.crypt$data, .crypt$iv, .crypt$session, key = "id_rsa", password = password) %>%
writeBin(zz)
close(zz)
推荐阅读
- python - 使用 pytest-xdist 跨主节点和工作节点访问共享资源
- haskell - 使用 GHC 插件解析类型
- python - 在绘图选择上过滤散景数据表
- python - 在避免多处理python中的内存泄漏后会删除一个变量并重新创建它吗?
- mongodb - 联系人的 MongoDB Schema 优化
- python-3.x - numpy.genfromtxt() 无法读取标题
- javascript - 在 React JS 中更改子属性的位置
- java - SharedPreferences 未保存在 EditTexts 中
- javascript - 如何访问其他js文件的express模块,express模块已经包含在app.js中
- python - 使用其他表单元素在烧瓶中上传文件失败并出现 400 错误