Next: , Previous: Verify, Up: Crypto Operations


7.6.3 Decrypt and Verify

— Function: gpgme_error_t gpgme_op_decrypt_verify (gpgme_ctx_t ctx, gpgme_data_t cipher, gpgme_data_t plain)

The function gpgme_op_decrypt_verify decrypts the ciphertext in the data object cipher and stores it into the data object plain. If cipher contains signatures, they will be verified.

After the operation completed, gpgme_op_decrypt_result and gpgme_op_verify_result can be used to retrieve more information about the signatures.

If the error code GPG_ERR_NO_DATA is returned, cipher does not contain any data to decrypt. However, it might still be signed. The information about detected signatures is available with gpgme_op_verify_result in this case.

The function returns the error code GPG_ERR_NO_ERROR if the ciphertext could be decrypted successfully, GPG_ERR_INV_VALUE if ctx, cipher or plain is not a valid pointer, GPG_ERR_NO_DATA if cipher does not contain any data to decrypt, GPG_ERR_DECRYPT_FAILED if cipher is not a valid cipher text, GPG_ERR_BAD_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: gpgme_error_t gpgme_op_decrypt_verify (gpgme_ctx_t ctx, gpgme_data_t cipher, gpgme_data_t plain)

The function gpgme_op_decrypt_verify_start initiates a gpgme_op_decrypt_verify operation. It can be completed by calling gpgme_wait on the context. See Waiting For Completion.

The function returns the error code GPG_ERR_NO_ERROR if the operation could be started successfully, GPG_ERR_INV_VALUE if ctx, cipher, plain or r_stat is not a valid pointer, and GPG_ERR_NO_DATA if cipher does not contain any data to decrypt.