gpg icon indicating copy to clipboard operation
gpg copied to clipboard

Password to decrypt directly in function

Open domingoscisci opened this issue 6 years ago • 3 comments

Hi, I need to decrypt the data to be used in a Rmarkdown script. Because Rmarkdown is not interactive, inserting the password is not possible. Is there a way to add a "password" attribute to the gpg_decrypt function? In Rmarkdown parameters can be used to safety prompt users for the password.

Thanks for your work! Domi

domingoscisci avatar Apr 10 '19 06:04 domingoscisci

Same problem here. Is there a solution to this?

jmueller17 avatar Dec 16 '19 20:12 jmueller17

I have the same problem and I have found that decrypting the file on the command line or evaluating by hand the corresponding chunk or line in the Rmarkdown script causes the keyring to request the password, which is then stored for a short time. During this time you can launch Rmarkdown and it will be able to decrypt the file without requesting the password...

dmkaplan2000 avatar Jun 27 '20 13:06 dmkaplan2000

I'm looking for the same exact thing. Trying to grab a file and decrypt as part of batch process.

I've given up and gone straight to the gpg.exe -- you can still load your key using the package functions.

The exe will be inside the directory with the gpg package.

./gpg.exe --batch --passphrase "PASSPHRASE" -d -o decryptedPath encryptedPath

To run it through R do something like this:

command <- paste("./R/win-library/3.5/gpg/bin/gpg.exe","--batch","--passphrase",paste0(""", PASSPHRASE, """),"-d","-o",paste0(""", decryptedFilePath, """),paste0(""", encryptedFilePath, """)) system(command)

thereelaristotle avatar Sep 24 '20 20:09 thereelaristotle