因此,对于上下文,我正在尝试使用 gpg 包解密和 xlsx 文件。如果我解密 as_text = TRUE,我会收到一条错误消息,并在字符串中嵌入了 nul。
writexl::write_xlsx(x = data.frame(x = 1:2, y = 1:2),
path = "testtemp/test_1/test2.xlsx")
encrypted_xlsx <- gpg::gpg_encrypt(
data = list.files("testtemp/test_1/",
full.names = TRUE,
pattern = "xlsx"
),
receiver = "mypublickey"
)
writeLines(
text = encrypted_xlsx,
con = "testtemp/test_1/test2.xlsx.gpg"
)
gpg::gpg_import("myprivatekey")
decrypted_file <- gpg::gpg_decrypt(
data = "testtemp/test_1/test2.xlsx.gpg",
verify = FALSE,
as_text = FALSE
)
xl <- readxl::read_xlsx(path = rawConnection(decrypted_file))
我在最后一行尝试的内容不起作用,但希望能传达我想要实现的目标。
platform x86_64-w64-mingw32
arch x86_64
os mingw32
system x86_64, mingw32
status
major 4
minor 0.2
year 2020
month 06
day 22
svn rev 78730
language R
version.string R version 4.0.2 (2020-06-22) 昵称再次起飞