CryptSignAndEncryptMessage (crypt32)
Last changed: -76.238.238.248

.
Summary
The CryptSignAndEncryptMessage function creates a hash of the specified content, signs the hash, encrypts the content, hashes the encrypted contents and the signed hash, and then encodes both the encrypted content and the signed hash. The result is the same as if the hash were first signed and then encrypted.

C# Signature:

[DllImport("crypt32.dll", SetLastError = true)]
static extern bool CryptSignAndEncryptMessage(
        ref CRYPT_SIGN_MESSAGE_PARA pSignPara,
        ref CRYPT_DECRYPT_MESSAGE_PARA pDecryptPara,
        int cRecipientCert,
        [In, MarshalAs(UnmanagedType.LPArray)] IntPtr[] rgpRecipientCert,
        byte[] pbToBeSignedAndEncrypted,
        int cbToBeSignedAndEncrypted,
        [In, Out] byte[] pbSignedAndEncryptedBlob,
        ref int pcbSignedAndEncryptedBlob);

VB Signature:

Declare Function CryptSignAndEncryptMessage Lib "crypt32.dll" (TODO) As TODO

User-Defined Types:

None.

Alternative Managed API:

Do you know one? Please contribute it!

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

Please add some!

Documentation