Commit 676c6e5a authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

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

parent 9194d600
......@@ -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;
......
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