我想使用强大的加密算法来保护C:\Program Files\CVD\lib\darkflow\darkflow\dark\darknet.py:54: UserWarning: darkflow/cfg/yolo.cfg not found, use darkflow/cfg/yolo.cfg instead
Traceback (most recent call last):
File "C:\Users\doctorf\Miniconda3\envs\dark-flow\lib\site-packages\cx_freeze-6.0b1-py3.5-win-amd64.egg\cx_Freeze\initscripts\__startup__.py", line 14, in run
File "C:\Users\doctorf\Miniconda3\envs\dark-flow\lib\site-packages\cx_freeze-6.0b1-py3.5-win-amd64.egg\cx_Freeze\initscripts\Console.py", line 26, in run
File "CVD.py", line 154, in <module>
File "CVD.py", line 67, in _main
File "D:\Project\python\Tracking-with-darkflow\darkflow\darkflow\net\build.py", line 58, in __init__
File "D:\Project\python\Tracking-with-darkflow\darkflow\darkflow\dark\darknet.py", line 17, in __init__
File "D:\Project\python\Tracking-with-darkflow\darkflow\darkflow\dark\darknet.py", line 68, in parse_cfg
File "D:\Project\python\Tracking-with-darkflow\darkflow\darkflow\utils\process.py", line 66, in cfg_yielder
File "D:\Project\python\Tracking-with-darkflow\darkflow\darkflow\utils\process.py", line 17, in parser
FileNotFoundError: [Errno 2] No such file or directory: 'darkflow/cfg/yolo.cfg'
文件的内容
因为它们可能包含敏感的个人数据,但不得
由于(法律)EU-GDPR要求而被披露。
如何在R中执行此操作?
在创建RData
文件之后,我想避免第二个手动步骤来加密文件,以最大程度地避免忘记或忽略任何RData
文件的风险。
在这种情况下,我正在使用Windows ...
答案 0 :(得分:3)
library(openssl)
x <- serialize(list(1,2,3), NULL)
passphrase <- charToRaw("This is super secret")
key <- sha256(passphrase)
encrypted_x <- aes_cbc_encrypt(x, key = key)
saveRDS(encrypted_x, "secret-x.rds")
encrypted_y <- readRDS("secret-x.rds")
y <- unserialize(aes_cbc_decrypt(encrypted_y, key = key))
您需要处理机密管理(即密钥),但是这种通用习语应该可以工作(带有更多的防弹功能)。
答案 1 :(得分:1)
我知道已经很晚了,但是签出这个包endecrypt
安装:
devtools::install_github("RevanthNemani\endecrypt")
使用以下功能进行列加密:
airquality <- EncryptDf(x = airquality, pub.key = pubkey, encryption.type = "aes256")
对于列解密:
airquality <- DecryptDf(x = airquality, prv.key = prvkey, encryption.type = "aes256")
签出此Github page
仅记得生成您的密钥并保存以供首次使用。在需要时加载键,并将键对象提供给功能。
例如
SaveGenKey(bits = 2048,
private.key.path = "Encription/private.pem",
public.key.path = "Encription/public.pem")
# Load keys already stored using this function
prvkey <- LoadKey(key.path = "Encription/private.pem", Private = T)
它非常易于使用,您的数据帧可以存储在数据库或Rdata文件中。
答案 2 :(得分:0)
Rcrypt库应该可以解决问题。 https://cran.r-project.org/web/packages/rcrypt/index.html。另请参见http://brettklamer.com/work/rcrypt/
一种避免额外手动步骤的简单方法是创建一个新功能,一次性处理保存和加密。也许遵循以下原则:
saveEncrypted <- function(mydataframe, outfile, mypass){
require(rcrypt)
save(mydataframe, file=outfile)
encrypt(as.character(file), output=paste(file,gpg,sep=.), passphrase=mypass)
}