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