Encrypting a Plaintext
......................
- Function: GpgmeError gpgme_op_encrypt (GpgmeCtx CTX,
GpgmeRecipients RSET, GpgmeData PLAIN, GpgmeData CIPHER)
The function `gpgme_op_encrypt' encrypts the plaintext in the data
object PLAIN for the recipients RSET and stores the ciphertext in
the data object CIPHER. The type of the ciphertext created is
determined by the ASCII armor and text mode attributes set for the
context CTX.
If `GPGME_Invalid_Recipients' is returned, some recipients in RSET
are invalid, but not all. In this case the plaintext is encrypted
for all valid recipients and returned in CIPHER. More information
about the invalid recipients is available with
`gpgme_get_op_info'. Note:Detailed Results.
If RECP is `NULL', symmetric rather than public key encryption is
performed. Symmetrically encrypted cipher text can be deciphered
with `gpgme_op_decrypt'. Note that in this case the crypto
backend needs to retrieve a passphrase from the user. Symmetric
encryption is currently only supported for the OpenPGP crypto
backend.
The function returns `GPGME_No_Error' if the ciphertext could be
created successfully, `GPGME_Invalid_Value' if CTX, RSET, PLAIN or
CIPHER is not a valid pointer, `GPGME_No_Recipients' if RSET does
not contain any valid recipients, `GPGME_Invalid_Recipients' if
RSET contains some invalid recipients, `GPGME_No_Passphrase' if
the passphrase for the secret key could not be retrieved, and
passes through any errors that are reported by the crypto engine
support routines.
- Function: GpgmeError gpgme_op_encrypt_start (GpgmeCtx CTX,
GpgmeRecipients RSET, GpgmeData PLAIN, GpgmeData CIPHER)
The function `gpgme_op_encrypt_start' initiates a
`gpgme_op_encrypt' operation. It can be completed by calling
`gpgme_wait' on the context. Note:Waiting For Completion.
The function returns `GPGME_No_Error' if the operation could be
started successfully, `GPGME_Invalid_Value' if CTX, RSET, PLAIN or
CIPHER is not a valid pointer, and `GPGME_No_Recipients' if RSET
does not contain any valid recipients.
- Function: GpgmeError gpgme_op_encrypt_sign (GpgmeCtx CTX,
GpgmeRecipients RSET, GpgmeData PLAIN, GpgmeData CIPHER)
The function `gpgme_op_encrypt_sign' does a combined encrypt and
sign operation. It is used like `gpgme_op_encrypt', but the
ciphertext also contains signatures for the signers listed in CTX.
The combined encrypt and sign operation is currently only available
for the OpenPGP crypto engine.
- Function: GpgmeError gpgme_op_encrypt_sign_start (GpgmeCtx CTX,
GpgmeRecipients RSET, GpgmeData PLAIN, GpgmeData CIPHER)
The function `gpgme_op_encrypt_sign_start' initiates a
`gpgme_op_encrypt_sign' operation. It can be completed by calling
`gpgme_wait' on the context. Note:Waiting For Completion.
The function returns `GPGME_No_Error' if the operation could be
started successfully, `GPGME_Invalid_Value' if CTX, RSET, PLAIN or
CIPHER is not a valid pointer, and `GPGME_No_Recipients' if RSET
does not contain any valid recipients.