Title: | GNU Privacy Guard for R |
---|---|
Description: | Bindings to GnuPG for working with OpenGPG (RFC4880) cryptographic methods. Includes utilities for public key encryption, creating and verifying digital signatures, and managing your local keyring. Some functionality depends on the version of GnuPG that is installed on the system. On Windows this package can be used together with 'GPG4Win' which provides a GUI for managing keys and entering passphrases. |
Authors: | Jeroen Ooms [aut, cre] |
Maintainer: | Jeroen Ooms <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.3.0 |
Built: | 2024-11-30 07:35:14 UTC |
Source: | https://github.com/jeroen/gpg |
Encrypt or decrypt a message using the public key from the receiver
.
Optionally the message can be signed using the private key of the sender.
gpg_encrypt(data, receiver, signer = NULL) gpg_decrypt(data, verify = TRUE, as_text = TRUE)
gpg_encrypt(data, receiver, signer = NULL) gpg_decrypt(data, verify = TRUE, as_text = TRUE)
data |
path or raw vector with data to encrypt / decrypt |
receiver |
key id(s) or fingerprint(s) for recepient(s) |
signer |
(optional) key id(s) or fingerprint(s) for the sender(s) to sign the message |
verify |
automatically checks that all signatures (if any) can be verified and raises an error otherwise |
as_text |
convert output to text. Set to FALSE if you expect binary data. |
Other gpg:
gpg_keygen()
,
gpg_keys
,
gpg_sign()
Generates a new standard private-public keypair. This function is mostly
for testing purposes. Use the gpg --gen-key
command line utility to generate an
official GPG key with custom fields and options.
gpg_keygen(name, email, passphrase = NULL)
gpg_keygen(name, email, passphrase = NULL)
name |
value for the |
email |
value for the |
passphrase |
(optional) protect with a passphrase |
GPG manual section on Unattended key generation.
Other gpg:
gpg_encrypt()
,
gpg_keys
,
gpg_sign()
Signing or encrypting with GPG require that the keys are stored in your personal keyring. Use gpg_version to see which keyring (home dir) you are using. Also see gpg_keygen for generating a new key.
gpg_import(file) gpg_recv(id, search = NULL, keyserver = NULL) gpg_send(id, keyserver = NULL) gpg_delete(id, secret = FALSE) gpg_export(id, secret = FALSE) gpg_list_keys(search = "", secret = FALSE) gpg_list_signatures(id)
gpg_import(file) gpg_recv(id, search = NULL, keyserver = NULL) gpg_send(id, keyserver = NULL) gpg_delete(id, secret = FALSE) gpg_export(id, secret = FALSE) gpg_list_keys(search = "", secret = FALSE) gpg_list_signatures(id)
file |
path to the key file or raw vector with key data |
id |
unique ID of the pubkey to import (starts with |
search |
string with name or email address to match the key info. |
keyserver |
address of http keyserver. Default behavior is to try several commonly used servers (MIT, Ubuntu, GnuPG, Surfnet) |
secret |
set to |
Other gpg:
gpg_encrypt()
,
gpg_keygen()
,
gpg_sign()
## Not run: # Submit key to a specific key server. gpg_send("87CC261267801A17", "https://keys.openpgp.org") # Submit key to many key servers. gpg_send("87CC261267801A17") ## End(Not run)
## Not run: # Submit key to a specific key server. gpg_send("87CC261267801A17", "https://keys.openpgp.org") # Submit key to many key servers. gpg_send("87CC261267801A17") ## End(Not run)
Use gpg_restart()
to find the gpg
program and home directory (which contains
configuration and keychains). Usually the default should be fine and you
do not need to run this function manually.
gpg_restart(home = NULL, path = NULL, debug = "none", silent = FALSE) gpg_version(silent = FALSE) gpg_info() gpg_options()
gpg_restart(home = NULL, path = NULL, debug = "none", silent = FALSE) gpg_version(silent = FALSE) gpg_info() gpg_options()
home |
path to your GPG configuration directory (including keyrings) |
path |
location of |
debug |
debugging level, integer between 1 and 9 |
silent |
suppress output of |
Use gpg_info()
to get your current engine settings. The gpg_version()
function
simply calls gpg --version
to see some verbose output about the gpg
executable.
gpg_options
reads options in the GnuPG configuration file, which is stored by
default in ~/.gnupg/gpg.conf
. Note that changing options might affect
other software using GnuPG.
gpg_version() gpg_info()
gpg_version() gpg_info()
Utilities to create and verify PGP signatures.
gpg_verify(signature, data = NULL, error = TRUE) gpg_sign(data, signer = NULL, mode = c("detach", "normal", "clear"))
gpg_verify(signature, data = NULL, error = TRUE) gpg_sign(data, signer = NULL, mode = c("detach", "normal", "clear"))
signature |
path or raw vector for the gpg signature (contains the |
data |
path or raw vector with data to sign or verify. In |
error |
raise an error if verification fails because you do not have the signer public key in your keyring. |
signer |
(optional) vector with key ID's to use for signing. If |
mode |
use |
Other gpg:
gpg_encrypt()
,
gpg_keygen()
,
gpg_keys
## Not run: # This requires you have the Debian master key in your keyring msg <- tempfile() sig <- tempfile() download.file("http://http.us.debian.org/debian/dists/stable/Release", msg) download.file("http://http.us.debian.org/debian/dists/stable/Release.gpg", sig) gpg_verify(sig, msg, error = FALSE) ## End(Not run)
## Not run: # This requires you have the Debian master key in your keyring msg <- tempfile() sig <- tempfile() download.file("http://http.us.debian.org/debian/dists/stable/Release", msg) download.file("http://http.us.debian.org/debian/dists/stable/Release.gpg", sig) gpg_verify(sig, msg, error = FALSE) ## End(Not run)
Function to prompt the user for a password to read a protected private key.
pinentry(prompt = "Enter your GPG passphrase:")
pinentry(prompt = "Enter your GPG passphrase:")
prompt |
the string printed when prompting the user for input. |
If available, this function calls the GnuPG pinentry
program. However this
only works in a terminal. Therefore the IDE can provide a custom password entry
widget by setting the askpass
option. If no such option is specified
we default to readline
.