crypt32(5/11): Implement getting the signer cert info from a
decoded signed message
Juan Lang
juan.lang at gmail.com
Mon Jul 30 14:18:46 CDT 2007
--Juan
-------------- next part --------------
From ae824bd7e4d585e1b95640feaf481e9fc4c55aee Mon Sep 17 00:00:00 2001
From: Juan Lang <juanlang at juan.corp.google.com>
Date: Mon, 30 Jul 2007 12:06:23 -0700
Subject: [PATCH] Implement getting the signer cert info from a decoded signed message
---
dlls/crypt32/msg.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/dlls/crypt32/msg.c b/dlls/crypt32/msg.c
index aca6a03..7e5a080 100644
--- a/dlls/crypt32/msg.c
+++ b/dlls/crypt32/msg.c
@@ -1697,6 +1697,38 @@ static BOOL CRYPT_CopySignerInfo(void *p
return ret;
}
+static BOOL CRYPT_CopySignerCertInfo(void *pvData, DWORD *pcbData,
+ const CMSG_SIGNER_INFO *in)
+{
+ DWORD size = sizeof(CERT_INFO);
+ BOOL ret;
+
+ size += in->Issuer.cbData;
+ size += in->SerialNumber.cbData;
+ if (!pvData)
+ {
+ *pcbData = size;
+ ret = TRUE;
+ }
+ else if (*pcbData < size)
+ {
+ *pcbData = size;
+ SetLastError(ERROR_MORE_DATA);
+ ret = FALSE;
+ }
+ else
+ {
+ LPBYTE nextData = (BYTE *)pvData + sizeof(CERT_INFO);
+ CERT_INFO *out = (CERT_INFO *)pvData;
+
+ memset(out, 0, sizeof(CERT_INFO));
+ CRYPT_CopyBlob(&out->Issuer, &in->Issuer, &nextData);
+ CRYPT_CopyBlob(&out->SerialNumber, &in->SerialNumber, &nextData);
+ ret = TRUE;
+ }
+ return ret;
+}
+
static BOOL CDecodeSignedMsg_GetParam(CDecodeMsg *msg, DWORD dwParamType,
DWORD dwIndex, void *pvData, DWORD *pcbData)
{
@@ -1747,6 +1779,18 @@ static BOOL CDecodeSignedMsg_GetParam(CD
else
SetLastError(CRYPT_E_INVALID_MSG_TYPE);
break;
+ case CMSG_SIGNER_CERT_INFO_PARAM:
+ if (msg->u.signedInfo)
+ {
+ if (dwIndex >= msg->u.signedInfo->cSignerInfo)
+ SetLastError(CRYPT_E_INVALID_INDEX);
+ else
+ ret = CRYPT_CopySignerCertInfo(pvData, pcbData,
+ &msg->u.signedInfo->rgSignerInfo[dwIndex]);
+ }
+ else
+ SetLastError(CRYPT_E_INVALID_MSG_TYPE);
+ break;
case CMSG_CERT_COUNT_PARAM:
if (msg->u.signedInfo)
ret = CRYPT_CopyParam(pvData, pcbData,
--
1.4.1
More information about the wine-patches
mailing list