Name

smime_decrypt — Decryption of a PKCS7 encrypted smime msg

Synopsis

varchar smime_decrypt ( in encrypted_mail_message varchar ,
in recipient_certificate varchar ,
in recipient_key varchar ,
in password_for_the_key varchar );

Description

This function performs decryption of a PKCS7 encrypted smime msg

Parameters

encrypted_mail_message

The text of the encrypted smime message

recipient_certificate

The certificate of the recipient (pem format)

recipient_key

The private key of recipient matching the recipient_certificate (pem format)

password_for_the_key

The secret to open the recipient_key (if key is encrypted)

Return Types

varchar

Examples

Example24.376.Decryption a PKCS7 encrypted smime msg

select smime_decrypt (file_to_string ('test.p7m'), 
                      file_to_string ('test.pem'), 
                      file_to_string ('test.key.pem'), 
                      'secret');
_______________________________________________________________________________
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
 charset=us-ascii

this is a test
_______________________________________________________________________________