Module: wine Branch: master Commit: 44948c3b38859cf63a3115b81a7c234a2ca9cba8 URL: http://source.winehq.org/git/wine.git/?a=commit;h=44948c3b38859cf63a3115b81a...
Author: Juan Lang juan.lang@gmail.com Date: Thu Aug 2 09:49:40 2007 -0700
crypt32: Implement decoding OID and directory name alt name entries.
---
dlls/crypt32/decode.c | 23 +++++++++++++++++++++-- dlls/crypt32/tests/encode.c | 2 -- 2 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/dlls/crypt32/decode.c b/dlls/crypt32/decode.c index b54b841..495febd 100644 --- a/dlls/crypt32/decode.c +++ b/dlls/crypt32/decode.c @@ -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; } } } diff --git a/dlls/crypt32/tests/encode.c b/dlls/crypt32/tests/encode.c index 92dca63..75dd321 100644 --- a/dlls/crypt32/tests/encode.c +++ b/dlls/crypt32/tests/encode.c @@ -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) {