crypt32: Implement getting outer content of a signed message.

This commit is contained in:
Juan Lang 2007-07-23 18:11:49 -07:00 committed by Alexandre Julliard
parent b80101eb65
commit 937b27f3a3
2 changed files with 28 additions and 4 deletions

View File

@ -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;

View File

@ -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));