From bcb4bc6be3ca1b1245dc4e4750179f04f4b9ef26 Mon Sep 17 00:00:00 2001 From: Juan Lang Date: Fri, 23 Oct 2009 14:11:27 -0700 Subject: [PATCH] crypt32: Trace netscape cert type extension. --- dlls/crypt32/chain.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/dlls/crypt32/chain.c b/dlls/crypt32/chain.c index 5e09cd71bd2..1b26bf3cc1e 100644 --- a/dlls/crypt32/chain.c +++ b/dlls/crypt32/chain.c @@ -936,6 +936,32 @@ static void dump_enhanced_key_usage(const CERT_EXTENSION *ext) } } +static void dump_netscape_cert_type(const CERT_EXTENSION *ext) +{ + CRYPT_BIT_BLOB usage; + DWORD size = sizeof(usage); + + if (CryptDecodeObjectEx(X509_ASN_ENCODING, X509_BITS, ext->Value.pbData, + ext->Value.cbData, CRYPT_DECODE_NOCOPY_FLAG, NULL, &usage, &size)) + { +#define trace_cert_type_bit(bits, bit) \ + if ((bits) & (bit)) TRACE_(chain)("%s\n", #bit) + if (usage.cbData) + { + trace_cert_type_bit(usage.pbData[0], + NETSCAPE_SSL_CLIENT_AUTH_CERT_TYPE); + trace_cert_type_bit(usage.pbData[0], + NETSCAPE_SSL_SERVER_AUTH_CERT_TYPE); + trace_cert_type_bit(usage.pbData[0], NETSCAPE_SMIME_CERT_TYPE); + trace_cert_type_bit(usage.pbData[0], NETSCAPE_SIGN_CERT_TYPE); + trace_cert_type_bit(usage.pbData[0], NETSCAPE_SSL_CA_CERT_TYPE); + trace_cert_type_bit(usage.pbData[0], NETSCAPE_SMIME_CA_CERT_TYPE); + trace_cert_type_bit(usage.pbData[0], NETSCAPE_SIGN_CA_CERT_TYPE); + } +#undef trace_cert_type_bit + } +} + static void dump_extension(const CERT_EXTENSION *ext) { TRACE_(chain)("%s (%scritical)\n", debugstr_a(ext->pszObjId), @@ -960,6 +986,8 @@ static void dump_extension(const CERT_EXTENSION *ext) dump_cert_policies(ext); else if (!strcmp(ext->pszObjId, szOID_ENHANCED_KEY_USAGE)) dump_enhanced_key_usage(ext); + else if (!strcmp(ext->pszObjId, szOID_NETSCAPE_CERT_TYPE)) + dump_netscape_cert_type(ext); } static LPCWSTR filetime_to_str(const FILETIME *time)