Module: wine Branch: master Commit: 937b27f3a37e45790a12f790fea9524d399be3bb URL: http://source.winehq.org/git/wine.git/?a=commit;h=937b27f3a37e45790a12f790fe...
Author: Juan Lang juan.lang@gmail.com Date: Mon Jul 23 18:11:49 2007 -0700
crypt32: Implement getting outer content of a signed message.
---
dlls/crypt32/msg.c | 28 ++++++++++++++++++++++++++++ dlls/crypt32/tests/msg.c | 4 ---- 2 files changed, 28 insertions(+), 4 deletions(-)
diff --git a/dlls/crypt32/msg.c b/dlls/crypt32/msg.c index cd1dd39..1fcf980 100644 --- a/dlls/crypt32/msg.c +++ b/dlls/crypt32/msg.c @@ -797,6 +797,34 @@ static BOOL CSignedEncodeMsg_GetParam(HCRYPTMSG hCryptMsg, DWORD dwParamType,
switch (dwParamType) { + case CMSG_CONTENT_PARAM: + { + CRYPT_CONTENT_INFO info; + + ret = CryptMsgGetParam(hCryptMsg, CMSG_BARE_CONTENT_PARAM, 0, NULL, + &info.Content.cbData); + if (ret) + { + info.Content.pbData = CryptMemAlloc(info.Content.cbData); + if (info.Content.pbData) + { + ret = CryptMsgGetParam(hCryptMsg, CMSG_BARE_CONTENT_PARAM, 0, + info.Content.pbData, &info.Content.cbData); + if (ret) + { + char oid_rsa_signed[] = szOID_RSA_signedData; + + info.pszObjId = oid_rsa_signed; + ret = CryptEncodeObjectEx(X509_ASN_ENCODING, + PKCS_CONTENT_INFO, &info, 0, NULL, pvData, pcbData); + } + CryptMemFree(info.Content.pbData); + } + else + ret = FALSE; + } + break; + } case CMSG_BARE_CONTENT_PARAM: { CRYPT_SIGNED_INFO info; diff --git a/dlls/crypt32/tests/msg.c b/dlls/crypt32/tests/msg.c index 7a244b5..f7c863c 100644 --- a/dlls/crypt32/tests/msg.c +++ b/dlls/crypt32/tests/msg.c @@ -1292,7 +1292,6 @@ static void test_signed_msg_encoding(void) check_param("detached signed empty bare content", msg, CMSG_BARE_CONTENT_PARAM, signedEmptyBareContent, sizeof(signedEmptyBareContent)); - todo_wine check_param("detached signed empty content", msg, CMSG_CONTENT_PARAM, signedEmptyContent, sizeof(signedEmptyContent)); ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), TRUE); @@ -1301,7 +1300,6 @@ static void test_signed_msg_encoding(void) signedHash, sizeof(signedHash)); check_param("detached signed bare content", msg, CMSG_BARE_CONTENT_PARAM, detachedSignedBareContent, sizeof(detachedSignedBareContent)); - todo_wine check_param("detached signed content", msg, CMSG_CONTENT_PARAM, detachedSignedContent, sizeof(detachedSignedContent)); SetLastError(0xdeadbeef); @@ -1317,14 +1315,12 @@ static void test_signed_msg_encoding(void)
check_param("signed empty bare content", msg, CMSG_BARE_CONTENT_PARAM, signedEmptyBareContent, sizeof(signedEmptyBareContent)); - todo_wine check_param("signed empty content", msg, CMSG_CONTENT_PARAM, signedEmptyContent, sizeof(signedEmptyContent)); ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), TRUE); ok(ret, "CryptMsgUpdate failed: %x\n", GetLastError()); check_param("signed bare content", msg, CMSG_BARE_CONTENT_PARAM, signedBareContent, sizeof(signedBareContent)); - todo_wine check_param("signed content", msg, CMSG_CONTENT_PARAM, signedContent, sizeof(signedContent));