From e0b13a20b5680e797072efd3033a7e10ed32c78d Mon Sep 17 00:00:00 2001 From: Juan Lang Date: Wed, 25 Jul 2007 18:09:37 -0700 Subject: [PATCH] crypt32: Add initial tests for decoding signed messages. --- dlls/crypt32/tests/msg.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/dlls/crypt32/tests/msg.c b/dlls/crypt32/tests/msg.c index f65c7f8f2b3..ad4113a7e0c 100644 --- a/dlls/crypt32/tests/msg.c +++ b/dlls/crypt32/tests/msg.c @@ -1843,6 +1843,24 @@ static void test_decode_msg_update(void) ret = CryptMsgUpdate(msg, bogusHashContent, sizeof(bogusHashContent), TRUE); ok(ret, "CryptMsgUpdate failed: %08x\n", GetLastError()); CryptMsgClose(msg); + + msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, 0, 0, NULL, NULL); + ret = CryptMsgUpdate(msg, signedContent, sizeof(signedContent), TRUE); + ok(ret, "CryptMsgUpdate failed: %08x\n", GetLastError()); + CryptMsgClose(msg); + msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, 0, 0, NULL, NULL); + SetLastError(0xdeadbeef); + ret = CryptMsgUpdate(msg, signedWithCertAndCrlBareContent, + sizeof(signedWithCertAndCrlBareContent), TRUE); + ok(!ret && GetLastError() == CRYPT_E_ASN1_BADTAG, + "Expected CRYPT_E_ASN1_BADTAG, got %08x\n", GetLastError()); + CryptMsgClose(msg); + msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, CMSG_SIGNED, 0, NULL, + NULL); + ret = CryptMsgUpdate(msg, signedWithCertAndCrlBareContent, + sizeof(signedWithCertAndCrlBareContent), TRUE); + ok(ret, "CryptMsgUpdate failed: %08x\n", GetLastError()); + CryptMsgClose(msg); } static const BYTE hashParam[] = { 0x08,0xd6,0xc0,0x5a,0x21,0x51,0x2a,0x79,0xa1, -- 2.11.4.GIT