Commit 7e10d48c authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

crypt32: Implement getting the signer cert info from a decoded signed message.

parent 555e85a2
......@@ -1697,6 +1697,38 @@ static BOOL CRYPT_CopySignerInfo(void *pvData, DWORD *pcbData,
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(CDecodeMsg *msg, DWORD dwParamType,
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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment