crypt32/tests: Add tests for decoding enveloped messages.
This commit is contained in:
parent
4bbde8fdd7
commit
5328687fb5
|
@ -2297,6 +2297,22 @@ static const BYTE bogusHashContent[] = {
|
|||
0x02,0x05,0x05,0x00,0x30,0x13,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,
|
||||
0x07,0x01,0xa0,0x06,0x04,0x04,0x01,0x02,0x03,0x04,0x04,0x10,0x00,0xd6,0xc0,
|
||||
0x5a,0x21,0x51,0x2a,0x79,0xa1,0xdf,0xeb,0x9d,0x2a,0x8f,0x26,0x2f };
|
||||
static const BYTE envelopedBareContentWithoutData[] = {
|
||||
0x30,0x81,0xdb,0x02,0x01,0x00,0x31,0x81,0xba,0x30,0x81,0xb7,0x02,0x01,0x00,
|
||||
0x30,0x20,0x30,0x0c,0x31,0x0a,0x30,0x08,0x06,0x03,0x55,0x04,0x03,0x13,0x01,
|
||||
0x4e,0x02,0x10,0x63,0x75,0x75,0x7a,0x53,0x36,0xa9,0xba,0x41,0xa5,0xcc,0x01,
|
||||
0x7f,0x76,0x4c,0xd9,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,
|
||||
0x01,0x01,0x05,0x00,0x04,0x81,0x80,0x87,0x46,0x26,0x56,0xe3,0xf3,0xa5,0x5b,
|
||||
0xd4,0x2c,0x03,0xcc,0x52,0x7e,0xf7,0x55,0xf1,0x34,0x9f,0x63,0xf6,0x04,0x9f,
|
||||
0xc5,0x13,0xf1,0xc9,0x57,0x0a,0xbc,0xa9,0x33,0xd2,0xf2,0x93,0xb6,0x5c,0x94,
|
||||
0xc3,0x49,0xd6,0xd6,0x6d,0xc4,0x91,0x38,0x80,0xdd,0x0d,0x82,0xef,0xe5,0x72,
|
||||
0x55,0x40,0x0a,0xdd,0x35,0xfe,0xdc,0x87,0x47,0x92,0xb1,0xbd,0x05,0xc9,0x18,
|
||||
0x0e,0xde,0x4b,0x00,0x70,0x40,0x31,0x1f,0x5d,0x6c,0x8f,0x3a,0xfb,0x9a,0xc3,
|
||||
0xb3,0x06,0xe7,0x68,0x3f,0x20,0x14,0x1c,0xf9,0x28,0x4b,0x0f,0x01,0x01,0xb6,
|
||||
0xfe,0x07,0xe5,0xd8,0xf0,0x7c,0x17,0xbc,0xec,0xfb,0xd7,0x73,0x8a,0x71,0x49,
|
||||
0x79,0x62,0xe4,0xbf,0xb5,0xe3,0x56,0xa6,0xb4,0x49,0x1e,0xdc,0xaf,0xd7,0x0e,
|
||||
0x30,0x19,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x01,0x30,0x0c,
|
||||
0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x03,0x04,0x05,0x00 };
|
||||
|
||||
static void test_decode_msg_update(void)
|
||||
{
|
||||
|
@ -2597,6 +2613,51 @@ static void test_decode_msg_update(void)
|
|||
ok(!ret && GetLastError() == CRYPT_E_MSG_ERROR,
|
||||
"expected CRYPT_E_MSG_ERROR, got %08x\n", GetLastError());
|
||||
CryptMsgClose(msg);
|
||||
|
||||
msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, CMSG_ENVELOPED, 0, NULL,
|
||||
NULL);
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = CryptMsgUpdate(msg, envelopedEmptyBareContent,
|
||||
sizeof(envelopedEmptyBareContent), TRUE);
|
||||
ok(ret, "CryptMsgUpdate failed: %08x\n", GetLastError());
|
||||
CryptMsgClose(msg);
|
||||
|
||||
msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, CMSG_ENVELOPED, 0, NULL,
|
||||
NULL);
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = CryptMsgUpdate(msg, envelopedEmptyContent,
|
||||
sizeof(envelopedEmptyContent), TRUE);
|
||||
todo_wine
|
||||
ok(!ret &&
|
||||
(GetLastError() == CRYPT_E_ASN1_BADTAG ||
|
||||
GetLastError() == OSS_DATA_ERROR), /* Win9x */
|
||||
"expected CRYPT_E_ASN1_BADTAG, got %08x\n", GetLastError());
|
||||
CryptMsgClose(msg);
|
||||
|
||||
msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, 0, 0, NULL, NULL);
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = CryptMsgUpdate(msg, envelopedEmptyBareContent,
|
||||
sizeof(envelopedEmptyBareContent), TRUE);
|
||||
ok(!ret &&
|
||||
(GetLastError() == CRYPT_E_ASN1_BADTAG ||
|
||||
GetLastError() == OSS_DATA_ERROR), /* Win9x */
|
||||
"expected CRYPT_E_ASN1_BADTAG, got %08x\n", GetLastError());
|
||||
CryptMsgClose(msg);
|
||||
|
||||
msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, 0, 0, NULL, NULL);
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = CryptMsgUpdate(msg, envelopedEmptyContent,
|
||||
sizeof(envelopedEmptyContent), TRUE);
|
||||
ok(ret, "CryptMsgUpdate failed: %08x\n", GetLastError());
|
||||
CryptMsgClose(msg);
|
||||
|
||||
msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, CMSG_ENVELOPED, 0, NULL,
|
||||
NULL);
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = CryptMsgUpdate(msg, envelopedBareContentWithoutData,
|
||||
sizeof(envelopedBareContentWithoutData), TRUE);
|
||||
ok(ret, "CryptMsgUpdate failed: %08x\n", GetLastError());
|
||||
CryptMsgClose(msg);
|
||||
}
|
||||
|
||||
static const BYTE hashParam[] = { 0x08,0xd6,0xc0,0x5a,0x21,0x51,0x2a,0x79,0xa1,
|
||||
|
@ -2670,13 +2731,92 @@ static const BYTE signedWithCertAndCrlComputedHash[] = {
|
|||
static BYTE keyIdIssuer[] = {
|
||||
0x30,0x13,0x31,0x11,0x30,0x0f,0x06,0x0a,0x2b,0x06,0x01,0x04,0x01,0x82,0x37,
|
||||
0x0a,0x07,0x01,0x04,0x01,0x01 };
|
||||
static const BYTE publicPrivateKeyPair[] = {
|
||||
0x07,0x02,0x00,0x00,0x00,0xa4,0x00,0x00,0x52,0x53,0x41,0x32,0x00,0x04,0x00,
|
||||
0x00,0x01,0x00,0x01,0x00,0x21,0x65,0x5d,0x97,0x19,0x3f,0xd0,0xd0,0x76,0x5b,
|
||||
0xb1,0x10,0x4e,0xcc,0x14,0xb5,0x92,0x0f,0x60,0xad,0xb6,0x74,0x8d,0x94,0x50,
|
||||
0xfd,0x14,0x5e,0xbc,0xf1,0x93,0xbf,0x24,0x21,0x64,0x9d,0xc7,0x77,0x04,0x54,
|
||||
0xd1,0xbd,0x3e,0xd8,0x3b,0x2a,0x8b,0x95,0x70,0xdf,0x19,0x20,0xed,0x76,0x39,
|
||||
0xfa,0x64,0x04,0xc6,0xf7,0x33,0x7b,0xaa,0x94,0x67,0x74,0xbc,0x6b,0xd5,0xa7,
|
||||
0x69,0x99,0x99,0x47,0x88,0xc0,0x7e,0x36,0xf1,0xc5,0x7d,0xa8,0xd8,0x07,0x48,
|
||||
0xe6,0x05,0x4f,0xf4,0x1f,0x37,0xd7,0xc7,0xa7,0x00,0x20,0xb3,0xe5,0x40,0x17,
|
||||
0x86,0x43,0x77,0xe0,0x32,0x39,0x11,0x9c,0xd9,0xd8,0x53,0x9b,0x45,0x42,0x54,
|
||||
0x65,0xca,0x15,0xbe,0xb2,0x44,0xf1,0xd0,0xf3,0xb6,0x4a,0x19,0xc8,0x3d,0x33,
|
||||
0x63,0x93,0x4f,0x7c,0x67,0xc6,0x58,0x6d,0xf6,0xb7,0x20,0xd8,0x30,0xcc,0x52,
|
||||
0xaa,0x68,0x66,0xf6,0x86,0xf8,0xe0,0x3a,0x73,0x0e,0x9d,0xc5,0x03,0x60,0x9e,
|
||||
0x08,0xe9,0x5e,0xd4,0x5e,0xcc,0xbb,0xc1,0x48,0xad,0x9d,0xbb,0xfb,0x26,0x61,
|
||||
0xa8,0x0e,0x9c,0xba,0xf1,0xd0,0x0b,0x5f,0x87,0xd4,0xb5,0xd2,0xdf,0x41,0xcb,
|
||||
0x7a,0xec,0xb5,0x87,0x59,0x6a,0x9d,0xb3,0x6c,0x06,0xee,0x1f,0xc5,0xae,0x02,
|
||||
0xa8,0x7f,0x33,0x6e,0x30,0x50,0x6d,0x65,0xd0,0x1f,0x00,0x47,0x43,0x25,0x90,
|
||||
0x4a,0xa8,0x74,0x8c,0x23,0x8b,0x15,0x8a,0x74,0xd2,0x03,0xa6,0x1c,0xc1,0x7e,
|
||||
0xbb,0xb1,0xa6,0x80,0x05,0x2b,0x62,0xfb,0x89,0xe5,0xba,0xc6,0xcc,0x12,0xce,
|
||||
0xa8,0xe9,0xc4,0xb5,0x9d,0xd8,0x11,0xdd,0x95,0x90,0x71,0xb0,0xfe,0xaa,0x14,
|
||||
0xce,0xd5,0xd0,0x5a,0x88,0x47,0xda,0x31,0xda,0x26,0x11,0x66,0xd1,0xd5,0xc5,
|
||||
0x1b,0x08,0xbe,0xc6,0xf3,0x15,0xbf,0x80,0x78,0xcf,0x55,0xe0,0x61,0xee,0xf5,
|
||||
0x71,0x1e,0x2f,0x0e,0xb3,0x67,0xf7,0xa1,0x86,0x04,0xcf,0x4b,0xc1,0x2f,0x94,
|
||||
0x73,0xd1,0x5d,0x0c,0xee,0x10,0x58,0xbb,0x74,0x0c,0x61,0x02,0x15,0x69,0x68,
|
||||
0xe0,0x21,0x3e,0xa6,0x27,0x22,0x8c,0xc8,0x61,0xbc,0xba,0xa9,0x4b,0x2e,0x71,
|
||||
0x77,0x74,0xdc,0x63,0x05,0x32,0x7a,0x93,0x4f,0xbf,0xc7,0xa5,0x3a,0xe3,0x25,
|
||||
0x4d,0x67,0xcf,0x78,0x1b,0x85,0x22,0x6c,0xfe,0x5c,0x34,0x0e,0x27,0x12,0xbc,
|
||||
0xd5,0x33,0x1a,0x75,0x8a,0x9c,0x40,0x39,0xe8,0xa0,0xc9,0xae,0xf8,0xaf,0x9a,
|
||||
0xc6,0x62,0x47,0xf3,0x5b,0xdf,0x5e,0xcd,0xc6,0xc0,0x5c,0xd7,0x0e,0x04,0x64,
|
||||
0x3d,0xdd,0x57,0xef,0xf6,0xcd,0xdf,0xd2,0x7e,0x17,0x6c,0x0a,0x47,0x5e,0x77,
|
||||
0x4b,0x02,0x49,0x78,0xc0,0xf7,0x09,0x6e,0xdf,0x96,0x04,0x51,0x74,0x3d,0x68,
|
||||
0x99,0x43,0x8e,0x03,0x16,0x46,0xa4,0x04,0x84,0x01,0x6e,0xd4,0xca,0x5c,0xab,
|
||||
0xb0,0xd3,0x82,0xf1,0xb9,0xba,0x51,0x99,0x03,0xe9,0x7f,0xdf,0x30,0x3b,0xf9,
|
||||
0x18,0xbb,0x80,0x7f,0xf0,0x89,0xbb,0x6d,0x98,0x95,0xb7,0xfd,0xd8,0xdf,0xed,
|
||||
0xf3,0x16,0x6f,0x96,0x4f,0xfd,0x54,0x66,0x6d,0x90,0xba,0xf5,0xcc,0xce,0x01,
|
||||
0x34,0x34,0x51,0x07,0x66,0x20,0xfb,0x4a,0x3c,0x7e,0x19,0xf8,0x8e,0x35,0x0e,
|
||||
0x07,0x48,0x74,0x38,0xd2,0x18,0xaa,0x2e,0x90,0x5e,0x0e,0xcc,0x50,0x6e,0x71,
|
||||
0x6f,0x54,0xdb,0xbf,0x7b,0xb4,0xf4,0x79,0x6a,0x21,0xa3,0x6d,0xdf,0x61,0xc0,
|
||||
0x8f,0xb3,0xb6,0xe1,0x8a,0x65,0x21,0x6e,0xf6,0x5b,0x80,0xf0,0xfb,0x28,0x87,
|
||||
0x13,0x06,0xd6,0xbc,0x28,0x5c,0xda,0xc5,0x13,0x13,0x44,0x8d,0xf4,0xa8,0x7b,
|
||||
0x5c,0x2a,0x7f,0x11,0x16,0x4e,0x52,0x41,0xe9,0xe7,0x8e };
|
||||
static const BYTE envelopedMessage[] = {
|
||||
0x30,0x81,0xf2,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x03,0xa0,
|
||||
0x81,0xe4,0x30,0x81,0xe1,0x02,0x01,0x00,0x31,0x81,0xba,0x30,0x81,0xb7,0x02,
|
||||
0x01,0x00,0x30,0x20,0x30,0x0c,0x31,0x0a,0x30,0x08,0x06,0x03,0x55,0x04,0x03,
|
||||
0x13,0x01,0x4e,0x02,0x10,0x63,0x75,0x75,0x7a,0x53,0x36,0xa9,0xba,0x41,0xa5,
|
||||
0xcc,0x01,0x7f,0x76,0x4c,0xd9,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,
|
||||
0x0d,0x01,0x01,0x01,0x05,0x00,0x04,0x81,0x80,0xc2,0x0d,0x59,0x87,0xb3,0x65,
|
||||
0xd2,0x64,0xcd,0xba,0xe3,0xaf,0x1e,0xa1,0xd3,0xdd,0xb3,0x53,0xfc,0x2f,0xae,
|
||||
0xdc,0x6d,0x2a,0x81,0x84,0x38,0x6f,0xdf,0x81,0xb1,0x65,0xba,0xac,0x59,0xb1,
|
||||
0x19,0x12,0x3f,0xde,0x12,0xce,0x77,0x42,0x71,0x67,0xa9,0x78,0x38,0x95,0x51,
|
||||
0xbb,0x66,0x78,0xbf,0xaf,0x0a,0x98,0x4b,0xba,0xa5,0xf0,0x8b,0x9f,0xef,0xcf,
|
||||
0x40,0x05,0xa1,0xd6,0x10,0xae,0xbf,0xb9,0xbd,0x4d,0x22,0x39,0x33,0x63,0x2b,
|
||||
0x0b,0xd3,0x0c,0xb5,0x4b,0xe8,0xfe,0x15,0xa8,0xa5,0x2c,0x86,0x33,0x80,0x6e,
|
||||
0x4c,0x7a,0x99,0x3c,0x6b,0x4b,0x60,0xfd,0x8e,0xb2,0xf3,0x82,0x2f,0x3e,0x1e,
|
||||
0xba,0xb9,0x78,0x24,0x32,0xab,0xa4,0x10,0x1a,0x38,0x94,0x10,0x8d,0xf8,0x70,
|
||||
0x3e,0x4e,0x30,0x1f,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x01,
|
||||
0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x03,0x04,0x05,0x00,0x80,
|
||||
0x04,0x5f,0x80,0xf2,0x17 };
|
||||
static const BYTE envelopedBareMessage[] = {
|
||||
0x30,0x81,0xe1,0x02,0x01,0x00,0x31,0x81,0xba,0x30,0x81,0xb7,0x02,0x01,0x00,
|
||||
0x30,0x20,0x30,0x0c,0x31,0x0a,0x30,0x08,0x06,0x03,0x55,0x04,0x03,0x13,0x01,
|
||||
0x4e,0x02,0x10,0x63,0x75,0x75,0x7a,0x53,0x36,0xa9,0xba,0x41,0xa5,0xcc,0x01,
|
||||
0x7f,0x76,0x4c,0xd9,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,
|
||||
0x01,0x01,0x05,0x00,0x04,0x81,0x80,0x69,0x79,0x12,0x6b,0xa1,0x2f,0xe9,0x0d,
|
||||
0x34,0x79,0x77,0xe9,0x15,0xf2,0xff,0x0c,0x9a,0xf2,0x87,0xbd,0x12,0xc4,0x2d,
|
||||
0x9e,0x81,0xc7,0x3c,0x74,0x05,0xdc,0x13,0xaf,0xe9,0xa2,0xba,0x72,0xe9,0xa5,
|
||||
0x2b,0x81,0x39,0xd3,0x62,0xaa,0x78,0xc3,0x90,0x4f,0x06,0xf0,0xdb,0x18,0x5e,
|
||||
0xe1,0x2e,0x19,0xa3,0xc2,0xac,0x1e,0xf1,0xbf,0xe6,0x03,0x00,0x96,0xfa,0xd2,
|
||||
0x66,0x73,0xd0,0x45,0x55,0x57,0x71,0xff,0x3a,0x0c,0xad,0xce,0xde,0x68,0xd4,
|
||||
0x45,0x20,0xc8,0x44,0x4d,0x5d,0xa2,0x98,0x79,0xb1,0x81,0x0f,0x8a,0xfc,0x70,
|
||||
0xa5,0x18,0xd2,0x30,0x65,0x22,0x84,0x02,0x24,0x48,0xf7,0xa4,0xe0,0xa5,0x6c,
|
||||
0xa8,0xa4,0xd0,0x86,0x4b,0x6e,0x9b,0x18,0xab,0x78,0xfa,0x76,0x12,0xce,0x55,
|
||||
0x30,0x1f,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x01,0x30,0x0c,
|
||||
0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x03,0x04,0x05,0x00,0x80,0x04,0x2c,
|
||||
0x2d,0xa3,0x6e };
|
||||
|
||||
static void test_decode_msg_get_param(void)
|
||||
{
|
||||
HCRYPTMSG msg;
|
||||
HCRYPTPROV hCryptProv;
|
||||
HCRYPTKEY key;
|
||||
BOOL ret;
|
||||
DWORD size = 0, value;
|
||||
LPBYTE buf;
|
||||
CMSG_CTRL_DECRYPT_PARA decryptPara = { sizeof(decryptPara), 0 };
|
||||
|
||||
msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, 0, 0, NULL, NULL);
|
||||
SetLastError(0xdeadbeef);
|
||||
|
@ -2886,6 +3026,71 @@ static void test_decode_msg_get_param(void)
|
|||
CryptMemFree(buf);
|
||||
}
|
||||
CryptMsgClose(msg);
|
||||
|
||||
msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, CMSG_ENVELOPED, 0, NULL,
|
||||
NULL);
|
||||
CryptMsgUpdate(msg, envelopedEmptyBareContent,
|
||||
sizeof(envelopedEmptyBareContent), TRUE);
|
||||
todo_wine
|
||||
check_param("enveloped empty bare content", msg, CMSG_CONTENT_PARAM, NULL,
|
||||
0);
|
||||
CryptMsgClose(msg);
|
||||
|
||||
msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, 0, 0, NULL, NULL);
|
||||
CryptMsgUpdate(msg, envelopedEmptyContent, sizeof(envelopedEmptyContent),
|
||||
TRUE);
|
||||
todo_wine
|
||||
check_param("enveloped empty content", msg, CMSG_CONTENT_PARAM, NULL, 0);
|
||||
CryptMsgClose(msg);
|
||||
|
||||
CryptAcquireContextA(&hCryptProv, NULL, MS_ENHANCED_PROV_A, PROV_RSA_FULL,
|
||||
CRYPT_VERIFYCONTEXT);
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = CryptImportKey(hCryptProv, publicPrivateKeyPair,
|
||||
sizeof(publicPrivateKeyPair), 0, 0, &key);
|
||||
ok(ret, "CryptImportKey failed: %08x\n", GetLastError());
|
||||
|
||||
msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, 0, 0, NULL, NULL);
|
||||
CryptMsgUpdate(msg, envelopedMessage, sizeof(envelopedMessage), TRUE);
|
||||
todo_wine
|
||||
check_param("enveloped message before decrypting", msg, CMSG_CONTENT_PARAM,
|
||||
envelopedMessage + sizeof(envelopedMessage) - 4, 4);
|
||||
decryptPara.hCryptProv = hCryptProv;
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = CryptMsgControl(msg, 0, CMSG_CTRL_DECRYPT, &decryptPara);
|
||||
todo_wine
|
||||
ok(ret, "CryptMsgControl failed: %08x\n", GetLastError());
|
||||
decryptPara.hCryptProv = 0;
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = CryptMsgControl(msg, 0, CMSG_CTRL_DECRYPT, &decryptPara);
|
||||
todo_wine
|
||||
ok(!ret && GetLastError() == CRYPT_E_ALREADY_DECRYPTED,
|
||||
"expected CRYPT_E_ALREADY_DECRYPTED, got %08x\n", GetLastError());
|
||||
todo_wine
|
||||
check_param("enveloped message", msg, CMSG_CONTENT_PARAM, msgData,
|
||||
sizeof(msgData));
|
||||
CryptMsgClose(msg);
|
||||
|
||||
msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, CMSG_ENVELOPED, 0, NULL,
|
||||
NULL);
|
||||
CryptMsgUpdate(msg, envelopedBareMessage, sizeof(envelopedBareMessage),
|
||||
TRUE);
|
||||
todo_wine
|
||||
check_param("enveloped bare message before decrypting", msg,
|
||||
CMSG_CONTENT_PARAM, envelopedBareMessage +
|
||||
sizeof(envelopedBareMessage) - 4, 4);
|
||||
decryptPara.hCryptProv = hCryptProv;
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = CryptMsgControl(msg, 0, CMSG_CTRL_DECRYPT, &decryptPara);
|
||||
todo_wine
|
||||
ok(ret, "CryptMsgControl failed: %08x\n", GetLastError());
|
||||
todo_wine
|
||||
check_param("enveloped bare message", msg, CMSG_CONTENT_PARAM, msgData,
|
||||
sizeof(msgData));
|
||||
CryptMsgClose(msg);
|
||||
|
||||
CryptDestroyKey(key);
|
||||
CryptReleaseContext(hCryptProv, 0);
|
||||
}
|
||||
|
||||
static void test_decode_msg(void)
|
||||
|
@ -3257,6 +3462,46 @@ static void test_msg_control(void)
|
|||
ok(ret || broken(GetLastError() == OSS_DATA_ERROR /* Win9x */),
|
||||
"CryptMsgControl failed: %08x\n", GetLastError());
|
||||
CryptMsgClose(msg);
|
||||
|
||||
msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, CMSG_ENVELOPED, 0, NULL,
|
||||
NULL);
|
||||
decryptPara.cbSize = 0;
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = CryptMsgControl(msg, 0, CMSG_CTRL_DECRYPT, &decryptPara);
|
||||
todo_wine
|
||||
ok(!ret && GetLastError() == E_INVALIDARG,
|
||||
"expected E_INVALIDARG, got %08x\n", GetLastError());
|
||||
decryptPara.cbSize = sizeof(decryptPara);
|
||||
if (!old_crypt32)
|
||||
{
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = CryptMsgControl(msg, 0, CMSG_CTRL_DECRYPT, &decryptPara);
|
||||
ok(!ret && GetLastError() == CRYPT_E_INVALID_MSG_TYPE,
|
||||
"expected CRYPT_E_INVALID_MSG_TYPE, got %08x\n", GetLastError());
|
||||
}
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = CryptMsgUpdate(msg, envelopedEmptyBareContent,
|
||||
sizeof(envelopedEmptyBareContent), TRUE);
|
||||
ok(ret, "CryptMsgUpdate failed: %08x\n", GetLastError());
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = CryptMsgControl(msg, 0, CMSG_CTRL_DECRYPT, &decryptPara);
|
||||
todo_wine
|
||||
ok(!ret && GetLastError() == CRYPT_E_INVALID_INDEX,
|
||||
"expected CRYPT_E_INVALID_INDEX, got %08x\n", GetLastError());
|
||||
CryptMsgClose(msg);
|
||||
|
||||
msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, CMSG_ENVELOPED, 0, NULL,
|
||||
NULL);
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = CryptMsgUpdate(msg, envelopedBareMessage,
|
||||
sizeof(envelopedBareMessage), TRUE);
|
||||
ok(ret, "CryptMsgUpdate failed: %08x\n", GetLastError());
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = CryptMsgControl(msg, 0, CMSG_CTRL_DECRYPT, &decryptPara);
|
||||
todo_wine
|
||||
ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
|
||||
"expected ERROR_INVALID_PARAMETER, got %08x\n", GetLastError());
|
||||
CryptMsgClose(msg);
|
||||
}
|
||||
|
||||
/* win9x has much less parameter checks and will crash on many tests
|
||||
|
|
Loading…
Reference in New Issue