This function will attempt to unlock a specific GPG key by first encrypting a
small amount of information using the (public) key and then immediately
decrypting it using the (private) key, thereby causing the keyring to
temporarily store the key passphrase. This can be helpful if one is trying
to knit a document with encrypted data chunks, but the key for those
data chunks is locked with a passphrase. See the package vignette section
Workarounds for GPG data chunk error: Password callback did not return a string value
for more details.
unlock_gpg_key_passphrase(
id = ifelse(is.null(name), ifelse(is.null(email), NULL,
gpg::gpg_list_keys()$id[gpg::gpg_list_keys()$email == email]),
gpg::gpg_list_keys()$id[gpg::gpg_list_keys()$name == name]),
name = NULL,
email = NULL
)
Identifier of the GPG key
Name associated with the desired GPG key
Email associated with the desired GPG key
Will return the identifier of the GPG key that was unlocked.
See also data_encode
, gpg_encrypt
.