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

This commit is contained in:
Juan Lang 2007-08-02 09:48:22 -07:00 committed by Alexandre Julliard
parent 9194d60061
commit 676c6e5a36
1 changed files with 19 additions and 3 deletions

View File

@ -1942,6 +1942,7 @@ static BOOL CRYPT_AsnEncodeAltNameEntry(const CERT_ALT_NAME_ENTRY *entry,
{
BOOL ret;
DWORD dataLen;
BYTE tag;
ret = TRUE;
switch (entry->dwAltNameChoice)
@ -1949,6 +1950,7 @@ static BOOL CRYPT_AsnEncodeAltNameEntry(const CERT_ALT_NAME_ENTRY *entry,
case CERT_ALT_NAME_RFC822_NAME:
case CERT_ALT_NAME_DNS_NAME:
case CERT_ALT_NAME_URL:
tag = ASN_CONTEXT | (entry->dwAltNameChoice - 1);
if (entry->u.pwszURL)
{
DWORD i;
@ -1968,13 +1970,24 @@ static BOOL CRYPT_AsnEncodeAltNameEntry(const CERT_ALT_NAME_ENTRY *entry,
else
dataLen = 0;
break;
case CERT_ALT_NAME_DIRECTORY_NAME:
tag = ASN_CONTEXT | ASN_CONSTRUCTOR | (entry->dwAltNameChoice - 1);
dataLen = entry->u.DirectoryName.cbData;
break;
case CERT_ALT_NAME_IP_ADDRESS:
tag = ASN_CONTEXT | (entry->dwAltNameChoice - 1);
dataLen = entry->u.IPAddress.cbData;
break;
case CERT_ALT_NAME_REGISTERED_ID:
/* FIXME: encode OID */
{
struct AsnEncodeTagSwappedItem swapped =
{ ASN_CONTEXT | (entry->dwAltNameChoice - 1), entry->u.pszRegisteredID,
CRYPT_AsnEncodeOid };
return CRYPT_AsnEncodeSwapTag(0, NULL, &swapped, 0, NULL, pbEncoded,
pcbEncoded);
}
case CERT_ALT_NAME_OTHER_NAME:
case CERT_ALT_NAME_DIRECTORY_NAME:
FIXME("name type %d unimplemented\n", entry->dwAltNameChoice);
return FALSE;
default:
@ -1997,7 +2010,7 @@ static BOOL CRYPT_AsnEncodeAltNameEntry(const CERT_ALT_NAME_ENTRY *entry,
}
else
{
*pbEncoded++ = ASN_CONTEXT | (entry->dwAltNameChoice - 1);
*pbEncoded++ = tag;
CRYPT_EncodeLen(dataLen, pbEncoded, &lenBytes);
pbEncoded += lenBytes;
switch (entry->dwAltNameChoice)
@ -2012,6 +2025,9 @@ static BOOL CRYPT_AsnEncodeAltNameEntry(const CERT_ALT_NAME_ENTRY *entry,
*pbEncoded++ = (BYTE)entry->u.pwszURL[i];
break;
}
case CERT_ALT_NAME_DIRECTORY_NAME:
memcpy(pbEncoded, entry->u.DirectoryName.pbData, dataLen);
break;
case CERT_ALT_NAME_IP_ADDRESS:
memcpy(pbEncoded, entry->u.IPAddress.pbData, dataLen);
break;