unlock_gpg_key_passphrase: Functions that attempts to unlock a gpg key for decryption

Description Usage Arguments Value Author(s) See Also

View source: R/utils.R

Description

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.

Usage

1
2
3
4
5
6
7
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
)

Arguments

id

Identifier of the GPG key

name

Name associated with the desired GPG key

email

Email associated with the desired GPG key

Value

Will return the identifier of the GPG key that was unlocked.

Author(s)

David M. Kaplan dmkaplan2000@gmail.com

See Also

See also data_encode, gpg_encrypt.


knitrdata documentation built on Dec. 8, 2020, 5:08 p.m.