Commit 51eee4e7 authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

cryptnet: Improve CryptGetObjectUrl stub for URL_OID_CERTIFICATE_ISSUER.

parent 850ea2a7
......@@ -120,16 +120,108 @@ static const char *url_oid_to_str(LPCSTR oid)
typedef BOOL (WINAPI *UrlDllGetObjectUrlFunc)(LPCSTR, LPVOID, DWORD,
PCRYPT_URL_ARRAY, DWORD *, PCRYPT_URL_INFO, DWORD *, LPVOID);
static LPWSTR name_value_to_str(CERT_NAME_BLOB *name)
{
DWORD len = CertNameToStrW(X509_ASN_ENCODING, name, CERT_SIMPLE_NAME_STR,
NULL, 0);
LPWSTR str = NULL;
if (len)
{
str = CryptMemAlloc(len * sizeof(WCHAR));
if (str)
CertNameToStrW(X509_ASN_ENCODING, name, CERT_SIMPLE_NAME_STR,
str, len);
}
return str;
}
static void dump_alt_name_entry(CERT_ALT_NAME_ENTRY *entry)
{
LPWSTR str;
switch (entry->dwAltNameChoice)
{
case CERT_ALT_NAME_OTHER_NAME:
TRACE("CERT_ALT_NAME_OTHER_NAME, oid = %s\n",
debugstr_a(entry->u.pOtherName->pszObjId));
break;
case CERT_ALT_NAME_RFC822_NAME:
TRACE("CERT_ALT_NAME_RFC822_NAME: %s\n",
debugstr_w(entry->u.pwszRfc822Name));
break;
case CERT_ALT_NAME_DNS_NAME:
TRACE("CERT_ALT_NAME_DNS_NAME: %s\n",
debugstr_w(entry->u.pwszDNSName));
break;
case CERT_ALT_NAME_DIRECTORY_NAME:
str = name_value_to_str(&entry->u.DirectoryName);
TRACE("CERT_ALT_NAME_DIRECTORY_NAME: %s\n", debugstr_w(str));
CryptMemFree(str);
break;
case CERT_ALT_NAME_URL:
TRACE("CERT_ALT_NAME_URL: %s\n", debugstr_w(entry->u.pwszURL));
break;
case CERT_ALT_NAME_IP_ADDRESS:
TRACE("CERT_ALT_NAME_IP_ADDRESS: %d bytes\n",
entry->u.IPAddress.cbData);
break;
case CERT_ALT_NAME_REGISTERED_ID:
TRACE("CERT_ALT_NAME_REGISTERED_ID: %s\n",
debugstr_a(entry->u.pszRegisteredID));
break;
default:
TRACE("dwAltNameChoice = %d\n", entry->dwAltNameChoice);
}
}
static BOOL WINAPI CRYPT_GetUrlFromCertificateIssuer(LPCSTR pszUrlOid,
LPVOID pvPara, DWORD dwFlags, PCRYPT_URL_ARRAY pUrlArray, DWORD *pcbUrlArray,
PCRYPT_URL_INFO pUrlInfo, DWORD *pcbUrlInfo, LPVOID pvReserved)
{
/* FIXME: This depends on the AIA (authority info access) extension being
* supported in crypt32.
*/
FIXME("\n");
SetLastError(CRYPT_E_NOT_FOUND);
return FALSE;
PCCERT_CONTEXT cert = pvPara;
PCERT_EXTENSION ext;
BOOL ret = FALSE;
/* The only applicable flag is CRYPT_GET_URL_FROM_EXTENSION */
if (dwFlags && !(dwFlags & CRYPT_GET_URL_FROM_EXTENSION))
{
SetLastError(CRYPT_E_NOT_FOUND);
return FALSE;
}
if ((ext = CertFindExtension(szOID_AUTHORITY_INFO_ACCESS,
cert->pCertInfo->cExtension, cert->pCertInfo->rgExtension)))
{
CERT_AUTHORITY_INFO_ACCESS *aia;
DWORD size;
ret = CryptDecodeObjectEx(X509_ASN_ENCODING, X509_AUTHORITY_INFO_ACCESS,
ext->Value.pbData, ext->Value.cbData, CRYPT_DECODE_ALLOC_FLAG, NULL,
&aia, &size);
if (ret)
{
DWORD i;
TRACE("%d access descriptions:\n", aia->cAccDescr);
for (i = 0; i < aia->cAccDescr; i++)
{
if (!strcmp(aia->rgAccDescr[i].pszAccessMethod,
szOID_PKIX_OCSP))
TRACE("OCSP:\n");
else if (!strcmp(aia->rgAccDescr[i].pszAccessMethod,
szOID_PKIX_CA_ISSUERS))
TRACE("CA issuers:\n");
dump_alt_name_entry(&aia->rgAccDescr[i].AccessLocation);
}
LocalFree(aia);
FIXME("authority info access unsupported\n");
SetLastError(CRYPT_E_NOT_FOUND);
ret = FALSE;
}
}
else
SetLastError(CRYPT_E_NOT_FOUND);
return ret;
}
static BOOL WINAPI CRYPT_GetUrlFromCertificateCRLDistPoint(LPCSTR pszUrlOid,
......
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