crypt32: Implement decoding OID and directory name alt name entries.

This commit is contained in:
Juan Lang 2007-08-02 09:49:40 -07:00 committed by Alexandre Julliard
parent 005b50e913
commit 44948c3b38
2 changed files with 21 additions and 4 deletions

View File

@ -2143,13 +2143,22 @@ static BOOL WINAPI CRYPT_AsnDecodeAltNameEntry(DWORD dwCertEncodingType,
case 6: /* uniformResourceIdentifier */
bytesNeeded += (dataLen + 1) * sizeof(WCHAR);
break;
case 4: /* directoryName */
case 7: /* iPAddress */
bytesNeeded += dataLen;
break;
case 8: /* registeredID */
/* FIXME: decode as OID */
ret = CRYPT_AsnDecodeOidIgnoreTag(dwCertEncodingType, NULL,
pbEncoded, cbEncoded, 0, NULL, NULL, &dataLen);
if (ret)
{
/* FIXME: ugly, shouldn't need to know internals of OID decode
* function to use it.
*/
bytesNeeded += dataLen - sizeof(LPSTR);
}
break;
case 0: /* otherName */
case 4: /* directoryName */
FIXME("%d: stub\n", pbEncoded[0] & ASN_TYPE_MASK);
SetLastError(CRYPT_E_ASN1_BADTAG);
ret = FALSE;
@ -2196,6 +2205,11 @@ static BOOL WINAPI CRYPT_AsnDecodeAltNameEntry(DWORD dwCertEncodingType,
debugstr_w(entry->u.pwszURL));
break;
}
case 4: /* directoryName */
entry->dwAltNameChoice = CERT_ALT_NAME_DIRECTORY_NAME;
/* The data are memory-equivalent with the IPAddress case,
* fall-through
*/
case 7: /* iPAddress */
/* The next data pointer is in the pwszURL spot, that is,
* the first 4 bytes. Need to move it to the next spot.
@ -2205,6 +2219,11 @@ static BOOL WINAPI CRYPT_AsnDecodeAltNameEntry(DWORD dwCertEncodingType,
memcpy(entry->u.IPAddress.pbData, pbEncoded + 1 + lenBytes,
dataLen);
break;
case 8: /* registeredID */
ret = CRYPT_AsnDecodeOidIgnoreTag(dwCertEncodingType, NULL,
pbEncoded, cbEncoded, 0, NULL, &entry->u.pszRegisteredID,
&dataLen);
break;
}
}
}

View File

@ -1522,7 +1522,6 @@ static void test_decodeAltName(DWORD dwEncoding)
ret = CryptDecodeObjectEx(dwEncoding, X509_ALTERNATE_NAME, encodedOidName,
sizeof(encodedOidName), CRYPT_DECODE_ALLOC_FLAG, NULL, (BYTE *)&buf,
&bufSize);
todo_wine
ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
if (buf)
{
@ -1540,7 +1539,6 @@ static void test_decodeAltName(DWORD dwEncoding)
ret = CryptDecodeObjectEx(dwEncoding, X509_ALTERNATE_NAME,
encodedDirectoryName, sizeof(encodedDirectoryName),
CRYPT_DECODE_ALLOC_FLAG, NULL, (BYTE *)&buf, &bufSize);
todo_wine
ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
if (buf)
{