Commit 44948c3b authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

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

parent 005b50e9
...@@ -2143,13 +2143,22 @@ static BOOL WINAPI CRYPT_AsnDecodeAltNameEntry(DWORD dwCertEncodingType, ...@@ -2143,13 +2143,22 @@ static BOOL WINAPI CRYPT_AsnDecodeAltNameEntry(DWORD dwCertEncodingType,
case 6: /* uniformResourceIdentifier */ case 6: /* uniformResourceIdentifier */
bytesNeeded += (dataLen + 1) * sizeof(WCHAR); bytesNeeded += (dataLen + 1) * sizeof(WCHAR);
break; break;
case 4: /* directoryName */
case 7: /* iPAddress */ case 7: /* iPAddress */
bytesNeeded += dataLen; bytesNeeded += dataLen;
break; break;
case 8: /* registeredID */ 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 0: /* otherName */
case 4: /* directoryName */
FIXME("%d: stub\n", pbEncoded[0] & ASN_TYPE_MASK); FIXME("%d: stub\n", pbEncoded[0] & ASN_TYPE_MASK);
SetLastError(CRYPT_E_ASN1_BADTAG); SetLastError(CRYPT_E_ASN1_BADTAG);
ret = FALSE; ret = FALSE;
...@@ -2196,6 +2205,11 @@ static BOOL WINAPI CRYPT_AsnDecodeAltNameEntry(DWORD dwCertEncodingType, ...@@ -2196,6 +2205,11 @@ static BOOL WINAPI CRYPT_AsnDecodeAltNameEntry(DWORD dwCertEncodingType,
debugstr_w(entry->u.pwszURL)); debugstr_w(entry->u.pwszURL));
break; 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 */ case 7: /* iPAddress */
/* The next data pointer is in the pwszURL spot, that is, /* The next data pointer is in the pwszURL spot, that is,
* the first 4 bytes. Need to move it to the next spot. * the first 4 bytes. Need to move it to the next spot.
...@@ -2205,6 +2219,11 @@ static BOOL WINAPI CRYPT_AsnDecodeAltNameEntry(DWORD dwCertEncodingType, ...@@ -2205,6 +2219,11 @@ static BOOL WINAPI CRYPT_AsnDecodeAltNameEntry(DWORD dwCertEncodingType,
memcpy(entry->u.IPAddress.pbData, pbEncoded + 1 + lenBytes, memcpy(entry->u.IPAddress.pbData, pbEncoded + 1 + lenBytes,
dataLen); dataLen);
break; break;
case 8: /* registeredID */
ret = CRYPT_AsnDecodeOidIgnoreTag(dwCertEncodingType, NULL,
pbEncoded, cbEncoded, 0, NULL, &entry->u.pszRegisteredID,
&dataLen);
break;
} }
} }
} }
......
...@@ -1522,7 +1522,6 @@ static void test_decodeAltName(DWORD dwEncoding) ...@@ -1522,7 +1522,6 @@ static void test_decodeAltName(DWORD dwEncoding)
ret = CryptDecodeObjectEx(dwEncoding, X509_ALTERNATE_NAME, encodedOidName, ret = CryptDecodeObjectEx(dwEncoding, X509_ALTERNATE_NAME, encodedOidName,
sizeof(encodedOidName), CRYPT_DECODE_ALLOC_FLAG, NULL, (BYTE *)&buf, sizeof(encodedOidName), CRYPT_DECODE_ALLOC_FLAG, NULL, (BYTE *)&buf,
&bufSize); &bufSize);
todo_wine
ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError()); ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
if (buf) if (buf)
{ {
...@@ -1540,7 +1539,6 @@ static void test_decodeAltName(DWORD dwEncoding) ...@@ -1540,7 +1539,6 @@ static void test_decodeAltName(DWORD dwEncoding)
ret = CryptDecodeObjectEx(dwEncoding, X509_ALTERNATE_NAME, ret = CryptDecodeObjectEx(dwEncoding, X509_ALTERNATE_NAME,
encodedDirectoryName, sizeof(encodedDirectoryName), encodedDirectoryName, sizeof(encodedDirectoryName),
CRYPT_DECODE_ALLOC_FLAG, NULL, (BYTE *)&buf, &bufSize); CRYPT_DECODE_ALLOC_FLAG, NULL, (BYTE *)&buf, &bufSize);
todo_wine
ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError()); ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
if (buf) if (buf)
{ {
......
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