UID | title | description | helpviewer_keywords | old-location | tech.root | ms.assetid | ms.date | ms.keywords | req.header | req.include-header | req.target-type | req.target-min-winverclnt | req.target-min-winversvr | req.kmdf-ver | req.umdf-ver | req.ddi-compliance | req.unicode-ansi | req.idl | req.max-support | req.namespace | req.assembly | req.type-library | req.lib | req.dll | req.irql | targetos | req.typenames | req.redist | ms.custom | f1_keywords | dev_langs | topic_type | api_type | api_location | api_name | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
NF:wincrypt.CryptEncryptMessage |
CryptEncryptMessage function (wincrypt.h) |
The CryptEncryptMessage function encrypts and encodes a message. |
|
security\cryptencryptmessage.htm |
security |
927f2e9a-96cf-4744-bd57-420b5034d28d |
12/05/2018 |
CryptEncryptMessage, CryptEncryptMessage function [Security], _crypto2_cryptencryptmessage, security.cryptencryptmessage, wincrypt/CryptEncryptMessage |
wincrypt.h |
Windows |
Windows XP [desktop apps only] |
Windows Server 2003 [desktop apps only] |
Crypt32.lib |
Crypt32.dll |
Windows |
19H1 |
|
|
|
|
|
|
The CryptEncryptMessage function encrypts and encodes a message.
A pointer to a CRYPT_ENCRYPT_MESSAGE_PARA structure that contains the encryption parameters.
The CryptEncryptMessage function does not support the SHA2 OIDs, szOID_DH_SINGLE_PASS_STDDH_SHA256_KDF and szOID_DH_SINGLE_PASS_STDDH_SHA384_KDF.
Number of elements in the rgpRecipientCert array.
Array of pointers to CERT_CONTEXT structures that contain the certificates of intended recipients of the message.
A pointer to a buffer that contains the message that is to be encrypted.
The size, in bytes, of the message that is to be encrypted.
A pointer to BLOB that contains a buffer that receives the encrypted and encoded message.
To set the size of this information for memory allocation purposes, this parameter can be NULL. For more information, see Retrieving Data of Unknown Length.
A pointer to a DWORD that specifies the size, in bytes, of the buffer pointed to by the pbEncryptedBlob parameter. When the function returns, this variable contains the size, in bytes, of the encrypted and encoded message copied to pbEncryptedBlob.
If the function succeeds, the function returns nonzero (TRUE).
If the function fails, it returns zero (FALSE). For extended error information, call GetLastError.
Return code | Description |
---|---|
|
If the buffer specified by the pbEncryptedBlob parameter is not large enough to hold the returned data, the function sets the ERROR_MORE_DATA code and stores the required buffer size, in bytes, in the variable pointed to by pcbEncryptedBlob. |
|
The message encoding type is not valid. Currently only PKCS_7_ASN_ENCODING is supported. The cbSize in *pEncryptPara is not valid. |
If the function fails, GetLastError may return an Abstract Syntax Notation One (ASN.1) encoding/decoding error. For information about these errors, see ASN.1 Encoding/Decoding Return Values.