Skip to content

Instantly share code, notes, and snippets.

@aragaer
Created September 11, 2011 13:30
Show Gist options
  • Save aragaer/1209583 to your computer and use it in GitHub Desktop.
Save aragaer/1209583 to your computer and use it in GitHub Desktop.
Fixes in crypt32
diff --git a/dlls/crypt32/cert.c b/dlls/crypt32/cert.c
index 75b0e12..8571c83 100644
--- a/dlls/crypt32/cert.c
+++ b/dlls/crypt32/cert.c
@@ -317,25 +317,28 @@ static BOOL CertContext_GetProperty(void *context, DWORD dwPropId,
break;
case CERT_KEY_IDENTIFIER_PROP_ID:
{
+ CRYPT_DATA_BLOB value;
+ DWORD size = sizeof(value);
PCERT_EXTENSION ext = CertFindExtension(
szOID_SUBJECT_KEY_IDENTIFIER, pCertContext->pCertInfo->cExtension,
pCertContext->pCertInfo->rgExtension);
if (ext)
- {
- CRYPT_DATA_BLOB value;
- DWORD size = sizeof(value);
-
ret = CryptDecodeObjectEx(X509_ASN_ENCODING,
szOID_SUBJECT_KEY_IDENTIFIER, ext->Value.pbData,
ext->Value.cbData, CRYPT_DECODE_NOCOPY_FLAG, NULL, &value,
&size);
- if (ret)
- {
- ret = CertContext_CopyParam(pvData, pcbData, value.pbData,
- value.cbData);
- CertContext_SetProperty(context, dwPropId, 0, &value);
- }
+ else // MSDN says so
+ ret = CertContext_GetHashProp(context, dwPropId, CALG_SHA1,
+ pCertContext->pCertInfo->SubjectPublicKeyInfo.PublicKey.pbData,
+ pCertContext->pCertInfo->SubjectPublicKeyInfo.PublicKey.cbData,
+ &value, &size);
+
+ if (ret)
+ {
+ ret = CertContext_CopyParam(pvData, pcbData, value.pbData,
+ value.cbData);
+ CertContext_SetProperty(context, dwPropId, 0, &value);
}
else
SetLastError(ERROR_INVALID_DATA);
diff --git a/dlls/crypt32/chain.c b/dlls/crypt32/chain.c
index 4bc2d05..b6029d5 100644
--- a/dlls/crypt32/chain.c
+++ b/dlls/crypt32/chain.c
@@ -1704,8 +1704,9 @@ static void dump_element(PCCERT_CONTEXT cert)
TRACE_(chain)("issued to %s\n", debugstr_w(name));
CryptMemFree(name);
}
- TRACE_(chain)("valid from %s to %s\n",
- filetime_to_str(&cert->pCertInfo->NotBefore),
+ TRACE_(chain)("valid from %s",
+ filetime_to_str(&cert->pCertInfo->NotBefore));
+ TRACE_(chain)(" to %s\n",
filetime_to_str(&cert->pCertInfo->NotAfter));
TRACE_(chain)("%d extensions\n", cert->pCertInfo->cExtension);
for (i = 0; i < cert->pCertInfo->cExtension; i++)
@@ -2434,7 +2435,7 @@ static PCertificateChain CRYPT_BuildAlternateContextFromChain(
return alternate;
}
-#define CHAIN_QUALITY_SIGNATURE_VALID 0x16
+#define CHAIN_QUALITY_SIGNATURE_VALID 16
#define CHAIN_QUALITY_TIME_VALID 8
#define CHAIN_QUALITY_COMPLETE_CHAIN 4
#define CHAIN_QUALITY_BASIC_CONSTRAINTS 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment