Specify whether the message should be encrypted, signed or have a public key attached.
Usage
encrypt(msg, encrypt = TRUE, sign = TRUE, public_key = TRUE)
signature(msg, public_key = TRUE)
Arguments
- msg
A message object.
- encrypt
Whether to encrypt the message. If
TRUE
then the entire message will be encrypted using the private key of the sender.- sign
Whether to sign the message. If
TRUE
then the entire message will be signed using the private key of the sender.- public_key
Whether to attach a public key. If
TRUE
then the public key of the sender will be attached.
Details
The signature()
function will add a digital signature to a message. It will
also optionally include a copy of the sender's public key.
The encrypt()
function will encrypt the contents of a message using the
public key(s) of the recipient(s). It can also add a digital signature to the
message (this is the default behaviour) and include a copy of the sender's
public key. Signing happens before encryption, so the digital signature
will only be accessible once the message has been decrypted. If a recipient
no longer has access to their private key or their email client is unable to
decrypt the message then they will not be able to access the message
contents.
Examples
if (FALSE) { # \dontrun{
msg <- envelope(
from = "flotilla@kriegsmarine.gov",
to = "schunk@u-boat.com",
subject = "Top Secret Message",
text = "Immediate readiness. There are indications that the invasion has begun."
)
# Encrypt and sign the message.
msg %>% encrypt()
# Only encrypt the message.
msg %>% encrypt(sign = FALSE)
# Only sign the message.
msg %>% signature()
msg %>% encrypt(encrypt = FALSE)
} # }