2 * Copyright 2002 Mike McCormack for CodeWeavers
3 * Copyright 2005-2006 Juan Lang
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include "wine/debug.h"
27 #include "wine/list.h"
28 #include "crypt32_private.h"
31 WINE_DEFAULT_DEBUG_CHANNEL(crypt);
33 static const WCHAR DllW[] = { 'D','l','l',0 };
35 static void init_function_sets(void);
36 static void init_oid_info(HINSTANCE hinst);
37 static void free_function_sets(void);
38 static void free_oid_info(void);
40 void crypt_oid_init(HINSTANCE hinst)
46 void crypt_oid_free(void)
52 CRITICAL_SECTION funcSetCS;
58 CRITICAL_SECTION cs; /* protects functions */
59 struct list functions;
66 CRYPT_OID_FUNC_ENTRY entry;
70 static void init_function_sets(void)
72 InitializeCriticalSection(&funcSetCS);
76 static void free_function_sets(void)
78 struct OIDFunctionSet *setCursor, *setNext;
80 LIST_FOR_EACH_ENTRY_SAFE(setCursor, setNext, &funcSets,
81 struct OIDFunctionSet, next)
83 struct OIDFunction *functionCursor, *funcNext;
85 list_remove(&setCursor->next);
86 CryptMemFree(setCursor->name);
87 CryptMemFree(setCursor);
88 LIST_FOR_EACH_ENTRY_SAFE(functionCursor, funcNext,
89 &setCursor->functions, struct OIDFunction, next)
91 list_remove(&functionCursor->next);
92 CryptMemFree(functionCursor);
94 DeleteCriticalSection(&setCursor->cs);
96 DeleteCriticalSection(&funcSetCS);
99 /* There is no free function associated with this; therefore, the sets are
100 * freed when crypt32.dll is unloaded.
102 HCRYPTOIDFUNCSET WINAPI CryptInitOIDFunctionSet(LPCSTR pszFuncName,
105 struct OIDFunctionSet *cursor, *ret = NULL;
107 TRACE("(%s, %lx)\n", debugstr_a(pszFuncName), dwFlags);
109 EnterCriticalSection(&funcSetCS);
110 LIST_FOR_EACH_ENTRY(cursor, &funcSets, struct OIDFunctionSet, next)
112 if (!strcasecmp(pszFuncName, cursor->name))
114 ret = (HCRYPTOIDFUNCSET)cursor;
120 ret = CryptMemAlloc(sizeof(struct OIDFunctionSet));
123 memset(ret, 0, sizeof(*ret));
124 ret->name = CryptMemAlloc(strlen(pszFuncName) + 1);
127 InitializeCriticalSection(&ret->cs);
128 list_init(&ret->functions);
129 strcpy(ret->name, pszFuncName);
130 list_add_tail(&funcSets, &ret->next);
139 LeaveCriticalSection(&funcSetCS);
141 return (HCRYPTOIDFUNCSET)ret;
144 static char *CRYPT_GetKeyName(DWORD dwEncodingType, LPCSTR pszFuncName,
147 static const char szEncodingTypeFmt[] =
148 "Software\\Microsoft\\Cryptography\\OID\\EncodingType %ld\\%s\\%s";
150 char numericOID[7]; /* enough for "#65535" */
154 /* MSDN says the encoding type is a mask, but it isn't treated that way.
155 * (E.g., if dwEncodingType were 3, the key names "EncodingType 1" and
156 * "EncodingType 2" would be expected if it were a mask. Instead native
157 * stores values in "EncodingType 3".
161 snprintf(numericOID, sizeof(numericOID), "#%d", LOWORD(pszOID));
167 /* This is enough: the lengths of the two string parameters are explicitly
168 * counted, and we need up to five additional characters for the encoding
169 * type. These are covered by the "%d", "%s", and "%s" characters in the
170 * format specifier that are removed by sprintf.
172 len = sizeof(szEncodingTypeFmt) + lstrlenA(pszFuncName) + lstrlenA(oid);
173 szKey = CryptMemAlloc(len);
175 sprintf(szKey, szEncodingTypeFmt, dwEncodingType, pszFuncName, oid);
179 BOOL WINAPI CryptGetDefaultOIDDllList(HCRYPTOIDFUNCSET hFuncSet,
180 DWORD dwEncodingType, LPWSTR pwszDllList, DWORD *pcchDllList)
183 struct OIDFunctionSet *set = (struct OIDFunctionSet *)hFuncSet;
188 TRACE("(%p, %ld, %p, %p)\n", hFuncSet, dwEncodingType, pwszDllList,
191 keyName = CRYPT_GetKeyName(dwEncodingType, set->name, "DEFAULT");
192 rc = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keyName, 0, NULL, 0,
193 KEY_READ, NULL, &key, NULL);
196 DWORD size = *pcchDllList * sizeof(WCHAR);
198 rc = RegQueryValueExW(key, DllW, NULL, NULL, (LPBYTE)pwszDllList,
201 *pcchDllList = size / sizeof(WCHAR);
204 /* No value, return an empty list */
216 CryptMemFree(keyName);
221 BOOL WINAPI CryptInstallOIDFunctionAddress(HMODULE hModule,
222 DWORD dwEncodingType, LPCSTR pszFuncName, DWORD cFuncEntry,
223 const CRYPT_OID_FUNC_ENTRY rgFuncEntry[], DWORD dwFlags)
226 struct OIDFunctionSet *set;
228 TRACE("(%p, %ld, %s, %ld, %p, %08lx)\n", hModule, dwEncodingType,
229 debugstr_a(pszFuncName), cFuncEntry, rgFuncEntry, dwFlags);
231 set = (struct OIDFunctionSet *)CryptInitOIDFunctionSet(pszFuncName, 0);
236 EnterCriticalSection(&set->cs);
237 for (i = 0; ret && i < cFuncEntry; i++)
239 struct OIDFunction *func;
241 if (HIWORD(rgFuncEntry[i].pszOID))
242 func = CryptMemAlloc(sizeof(struct OIDFunction)
243 + strlen(rgFuncEntry[i].pszOID) + 1);
245 func = CryptMemAlloc(sizeof(struct OIDFunction));
248 func->encoding = dwEncodingType;
249 if (HIWORD(rgFuncEntry[i].pszOID))
251 func->entry.pszOID = (LPSTR)((LPBYTE)func + sizeof(*func));
252 strcpy((LPSTR)func->entry.pszOID, rgFuncEntry[i].pszOID);
255 func->entry.pszOID = rgFuncEntry[i].pszOID;
256 func->entry.pvFuncAddr = rgFuncEntry[i].pvFuncAddr;
257 list_add_tail(&set->functions, &func->next);
262 LeaveCriticalSection(&set->cs);
269 static BOOL CRYPT_GetFuncFromReg(DWORD dwEncodingType, LPCSTR pszOID,
270 LPCSTR szFuncName, LPVOID *ppvFuncAddr, HCRYPTOIDFUNCADDR *phFuncAddr)
274 const char *funcName;
278 keyName = CRYPT_GetKeyName(dwEncodingType, szFuncName, pszOID);
279 rc = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keyName, 0, KEY_READ, &key);
282 DWORD type, size = 0;
284 rc = RegQueryValueExA(key, "FuncName", NULL, &type, NULL, &size);
285 if (rc == ERROR_MORE_DATA && type == REG_SZ)
287 funcName = CryptMemAlloc(size);
288 rc = RegQueryValueExA(key, "FuncName", NULL, &type,
289 (LPBYTE)funcName, &size);
292 funcName = szFuncName;
293 rc = RegQueryValueExW(key, DllW, NULL, &type, NULL, &size);
294 if (rc == ERROR_MORE_DATA && type == REG_SZ)
296 LPWSTR dllName = CryptMemAlloc(size);
300 rc = RegQueryValueExW(key, DllW, NULL, NULL,
301 (LPBYTE)dllName, &size);
306 /* This is a bit of a hack; MSDN describes a more
307 * complicated unload routine than this will allow.
308 * Still, this seems to suffice for now.
310 lib = LoadLibraryW(dllName);
313 *ppvFuncAddr = GetProcAddress(lib, szFuncName);
316 *phFuncAddr = (HCRYPTOIDFUNCADDR)lib;
321 /* Unload the library, the caller doesn't want
322 * to unload it when the return value is NULL.
330 CryptMemFree(dllName);
335 if (funcName != szFuncName)
336 CryptMemFree((char *)funcName);
341 CryptMemFree(keyName);
345 BOOL WINAPI CryptGetOIDFunctionAddress(HCRYPTOIDFUNCSET hFuncSet,
346 DWORD dwEncodingType, LPCSTR pszOID, DWORD dwFlags, void **ppvFuncAddr,
347 HCRYPTOIDFUNCADDR *phFuncAddr)
350 struct OIDFunctionSet *set = (struct OIDFunctionSet *)hFuncSet;
352 TRACE("(%p, %ld, %s, %08lx, %p, %p)\n", hFuncSet, dwEncodingType,
353 debugstr_a(pszOID), dwFlags, ppvFuncAddr, phFuncAddr);
356 if (!(dwFlags & CRYPT_GET_INSTALLED_OID_FUNC_FLAG))
358 struct OIDFunction *function;
360 EnterCriticalSection(&set->cs);
361 LIST_FOR_EACH_ENTRY(function, &set->functions, struct OIDFunction, next)
363 if (function->encoding == dwEncodingType)
367 if (HIWORD(function->entry.pszOID &&
368 !strcasecmp(function->entry.pszOID, pszOID)))
370 *ppvFuncAddr = function->entry.pvFuncAddr;
371 *phFuncAddr = NULL; /* FIXME: what should it be? */
376 else if (function->entry.pszOID == pszOID)
378 *ppvFuncAddr = function->entry.pvFuncAddr;
379 *phFuncAddr = NULL; /* FIXME: what should it be? */
385 LeaveCriticalSection(&set->cs);
388 ret = CRYPT_GetFuncFromReg(dwEncodingType, pszOID, set->name,
389 ppvFuncAddr, phFuncAddr);
393 BOOL WINAPI CryptFreeOIDFunctionAddress(HCRYPTOIDFUNCADDR hFuncAddr,
396 TRACE("(%p, %08lx)\n", hFuncAddr, dwFlags);
398 /* FIXME: as MSDN states, need to check for DllCanUnloadNow in the DLL,
399 * and only unload it if it can be unloaded. Also need to implement ref
400 * counting on the functions.
402 FreeLibrary((HMODULE)hFuncAddr);
406 BOOL WINAPI CryptRegisterDefaultOIDFunction(DWORD dwEncodingType,
407 LPCSTR pszFuncName, DWORD dwIndex, LPCWSTR pwszDll)
409 FIXME("(%lx,%s,%lx,%s) stub!\n", dwEncodingType, pszFuncName, dwIndex,
410 debugstr_w(pwszDll));
414 BOOL WINAPI CryptUnregisterDefaultOIDFunction(DWORD dwEncodingType,
415 LPCSTR pszFuncName, LPCWSTR pwszDll)
417 FIXME("(%lx %s %s): stub\n", dwEncodingType, debugstr_a(pszFuncName),
418 debugstr_w(pwszDll));
422 BOOL WINAPI CryptGetDefaultOIDFunctionAddress(HCRYPTOIDFUNCSET hFuncSet,
423 DWORD dwEncodingType, LPCWSTR pwszDll, DWORD dwFlags, void *ppvFuncAddr,
424 HCRYPTOIDFUNCADDR *phFuncAddr)
426 FIXME("(%p, %ld, %s, %08lx, %p, %p): stub\n", hFuncSet, dwEncodingType,
427 debugstr_w(pwszDll), dwFlags, ppvFuncAddr, phFuncAddr);
431 BOOL WINAPI CryptRegisterOIDFunction(DWORD dwEncodingType, LPCSTR pszFuncName,
432 LPCSTR pszOID, LPCWSTR pwszDll, LPCSTR pszOverrideFuncName)
438 TRACE("(%lx, %s, %s, %s, %s)\n", dwEncodingType, pszFuncName, pszOID,
439 debugstr_w(pwszDll), pszOverrideFuncName);
441 /* This only registers functions for encoding certs, not messages */
442 if (!GET_CERT_ENCODING_TYPE(dwEncodingType))
445 /* Native does nothing pwszDll is NULL */
449 /* I'm not matching MS bug for bug here, because I doubt any app depends on
450 * it: native "succeeds" if pszFuncName is NULL, but the nonsensical entry
451 * it creates would never be used.
453 if (!pszFuncName || !pszOID)
455 SetLastError(HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER));
459 szKey = CRYPT_GetKeyName(dwEncodingType, pszFuncName, pszOID);
460 TRACE("Key name is %s\n", debugstr_a(szKey));
465 r = RegCreateKeyA(HKEY_LOCAL_MACHINE, szKey, &hKey);
467 if(r != ERROR_SUCCESS)
470 /* write the values */
471 if (pszOverrideFuncName)
472 RegSetValueExA(hKey, "FuncName", 0, REG_SZ,
473 (const BYTE*)pszOverrideFuncName, lstrlenA(pszOverrideFuncName) + 1);
474 RegSetValueExW(hKey, DllW, 0, REG_SZ, (const BYTE*) pwszDll,
475 (lstrlenW(pwszDll) + 1) * sizeof (WCHAR));
481 BOOL WINAPI CryptUnregisterOIDFunction(DWORD dwEncodingType, LPCSTR pszFuncName,
487 TRACE("%lx %s %s\n", dwEncodingType, pszFuncName, pszOID);
489 if (!GET_CERT_ENCODING_TYPE(dwEncodingType))
492 if (!pszFuncName || !pszOID)
494 SetLastError(ERROR_INVALID_PARAMETER);
498 szKey = CRYPT_GetKeyName(dwEncodingType, pszFuncName, pszOID);
499 rc = RegDeleteKeyA(HKEY_LOCAL_MACHINE, szKey);
503 return rc ? FALSE : TRUE;
506 BOOL WINAPI CryptGetOIDFunctionValue(DWORD dwEncodingType, LPCSTR pszFuncName,
507 LPCSTR pszOID, LPCWSTR pwszValueName, DWORD *pdwValueType, BYTE *pbValueData,
514 TRACE("%lx %s %s %s %p %p %p\n", dwEncodingType, debugstr_a(pszFuncName),
515 debugstr_a(pszOID), debugstr_w(pwszValueName), pdwValueType, pbValueData,
518 if (!GET_CERT_ENCODING_TYPE(dwEncodingType))
521 if (!pszFuncName || !pszOID || !pwszValueName)
523 SetLastError(ERROR_INVALID_PARAMETER);
527 szKey = CRYPT_GetKeyName(dwEncodingType, pszFuncName, pszOID);
528 rc = RegOpenKeyA(HKEY_LOCAL_MACHINE, szKey, &hKey);
534 rc = RegQueryValueExW(hKey, pwszValueName, NULL, pdwValueType,
535 pbValueData, pcbValueData);
540 return rc ? FALSE : TRUE;
543 BOOL WINAPI CryptSetOIDFunctionValue(DWORD dwEncodingType, LPCSTR pszFuncName,
544 LPCSTR pszOID, LPCWSTR pwszValueName, DWORD dwValueType,
545 const BYTE *pbValueData, DWORD cbValueData)
551 TRACE("%lx %s %s %s %ld %p %ld\n", dwEncodingType, debugstr_a(pszFuncName),
552 debugstr_a(pszOID), debugstr_w(pwszValueName), dwValueType, pbValueData,
555 if (!GET_CERT_ENCODING_TYPE(dwEncodingType))
558 if (!pszFuncName || !pszOID || !pwszValueName)
560 SetLastError(ERROR_INVALID_PARAMETER);
564 szKey = CRYPT_GetKeyName(dwEncodingType, pszFuncName, pszOID);
565 rc = RegOpenKeyA(HKEY_LOCAL_MACHINE, szKey, &hKey);
571 rc = RegSetValueExW(hKey, pwszValueName, 0, dwValueType, pbValueData,
577 return rc ? FALSE : TRUE;
580 CRITICAL_SECTION oidInfoCS;
583 static const WCHAR tripledes[] = { '3','d','e','s',0 };
584 static const WCHAR cms3deswrap[] = { 'C','M','S','3','D','E','S','w','r','a',
586 static const WCHAR cmsrc2wrap[] = { 'C','M','S','R','C','2','w','r','a','p',0 };
587 static const WCHAR des[] = { 'd','e','s',0 };
588 static const WCHAR md2[] = { 'm','d','2',0 };
589 static const WCHAR md4[] = { 'm','d','4',0 };
590 static const WCHAR md5[] = { 'm','d','5',0 };
591 static const WCHAR rc2[] = { 'r','c','2',0 };
592 static const WCHAR rc4[] = { 'r','c','4',0 };
593 static const WCHAR sha[] = { 's','h','a',0 };
594 static const WCHAR sha1[] = { 's','h','a','1',0 };
595 static const WCHAR RSA[] = { 'R','S','A',0 };
596 static const WCHAR RSA_KEYX[] = { 'R','S','A','_','K','E','Y','X',0 };
597 static const WCHAR RSA_SIGN[] = { 'R','S','A','_','S','I','G','N',0 };
598 static const WCHAR DSA[] = { 'D','S','A',0 };
599 static const WCHAR DSA_SIGN[] = { 'D','S','A','_','S','I','G','N',0 };
600 static const WCHAR DH[] = { 'D','H',0 };
601 static const WCHAR DSS[] = { 'D','S','S',0 };
602 static const WCHAR mosaicKMandUpdSig[] =
603 { 'm','o','s','a','i','c','K','M','a','n','d','U','p','d','S','i','g',0 };
604 static const WCHAR ESDH[] = { 'E','S','D','H',0 };
605 static const WCHAR NO_SIGN[] = { 'N','O','S','I','G','N',0 };
606 static const WCHAR dsaSHA1[] = { 'd','s','a','S','H','A','1',0 };
607 static const WCHAR md2RSA[] = { 'm','d','2','R','S','A',0 };
608 static const WCHAR md4RSA[] = { 'm','d','4','R','S','A',0 };
609 static const WCHAR md5RSA[] = { 'm','d','5','R','S','A',0 };
610 static const WCHAR shaDSA[] = { 's','h','a','D','S','A',0 };
611 static const WCHAR sha1DSA[] = { 's','h','a','1','D','S','A',0 };
612 static const WCHAR shaRSA[] = { 's','h','a','R','S','A',0 };
613 static const WCHAR sha1RSA[] = { 's','h','a','1','R','S','A',0 };
614 static const WCHAR mosaicUpdatedSig[] =
615 { 'm','o','s','a','i','c','U','p','d','a','t','e','d','S','i','g',0 };
616 static const WCHAR CN[] = { 'C','N',0 };
617 static const WCHAR L[] = { 'L',0 };
618 static const WCHAR O[] = { 'O',0 };
619 static const WCHAR OU[] = { 'O','U',0 };
620 static const WCHAR E[] = { 'E',0 };
621 static const WCHAR C[] = { 'C',0 };
622 static const WCHAR S[] = { 'S',0 };
623 static const WCHAR ST[] = { 'S','T',0 };
624 static const WCHAR STREET[] = { 'S','T','R','E','E','T',0 };
625 static const WCHAR T[] = { 'T',0 };
626 static const WCHAR Title[] = { 'T','i','t','l','e',0 };
627 static const WCHAR G[] = { 'G',0 };
628 static const WCHAR GivenName[] = { 'G','i','v','e','n','N','a','m','e',0 };
629 static const WCHAR I[] = { 'I',0 };
630 static const WCHAR Initials[] = { 'I','n','i','t','i','a','l','s',0 };
631 static const WCHAR SN[] = { 'S','N',0 };
632 static const WCHAR DC[] = { 'D','C',0 };
633 static const WCHAR Description[] =
634 { 'D','e','s','c','r','i','p','t','i','o','n',0 };
635 static const WCHAR PostalCode[] = { 'P','o','s','t','a','l','C','o','d','e',0 };
636 static const WCHAR POBox[] = { 'P','O','B','o','x',0 };
637 static const WCHAR Phone[] = { 'P','h','o','n','e',0 };
638 static const WCHAR X21Address[] = { 'X','2','1','A','d','d','r','e','s','s',0 };
639 static const WCHAR dnQualifier[] =
640 { 'd','n','Q','u','a','l','i','f','i','e','r',0 };
641 static const WCHAR Email[] = { 'E','m','a','i','l',0 };
642 static const WCHAR GN[] = { 'G','N',0 };
644 static const DWORD noNullFlag = CRYPT_OID_NO_NULL_ALGORITHM_PARA_FLAG;
645 static const DWORD mosaicFlags = CRYPT_OID_INHIBIT_SIGNATURE_FORMAT_FLAG |
646 CRYPT_OID_NO_NULL_ALGORITHM_PARA_FLAG;
647 static const CRYPT_DATA_BLOB noNullBlob = { sizeof(noNullFlag),
648 (LPBYTE)&noNullFlag };
649 static const CRYPT_DATA_BLOB mosaicFlagsBlob = { sizeof(mosaicFlags),
650 (LPBYTE)&mosaicFlags };
652 static const DWORD rsaSign = CALG_RSA_SIGN;
653 static const DWORD dssSign[2] = { CALG_DSS_SIGN,
654 CRYPT_OID_NO_NULL_ALGORITHM_PARA_FLAG };
655 static const DWORD mosaicSign[2] = { CALG_DSS_SIGN,
656 CRYPT_OID_INHIBIT_SIGNATURE_FORMAT_FLAG |
657 CRYPT_OID_NO_NULL_ALGORITHM_PARA_FLAG };
658 static const CRYPT_DATA_BLOB rsaSignBlob = { sizeof(rsaSign),
660 static const CRYPT_DATA_BLOB dssSignBlob = { sizeof(dssSign),
662 static const CRYPT_DATA_BLOB mosaicSignBlob = { sizeof(mosaicSign),
663 (LPBYTE)mosaicSign };
665 static const DWORD ia5String[] = { CERT_RDN_IA5_STRING, 0 };
666 static const DWORD numericString[] = { CERT_RDN_NUMERIC_STRING, 0 };
667 static const DWORD printableString[] = { CERT_RDN_PRINTABLE_STRING, 0 };
668 static const DWORD domainCompTypes[] = { CERT_RDN_IA5_STRING,
669 CERT_RDN_UTF8_STRING, 0 };
670 static const CRYPT_DATA_BLOB ia5StringBlob = { sizeof(ia5String),
672 static const CRYPT_DATA_BLOB numericStringBlob = { sizeof(numericString),
673 (LPBYTE)numericString };
674 static const CRYPT_DATA_BLOB printableStringBlob = { sizeof(printableString),
675 (LPBYTE)printableString };
676 static const CRYPT_DATA_BLOB domainCompTypesBlob = { sizeof(domainCompTypes),
677 (LPBYTE)domainCompTypes };
679 struct OIDInfoConstructor {
684 const CRYPT_DATA_BLOB *blob;
685 } oidInfoConstructors[] = {
686 { 1, szOID_OIWSEC_sha1, CALG_SHA1, sha1, NULL },
687 { 1, szOID_OIWSEC_sha1, CALG_SHA1, sha, NULL },
688 { 1, szOID_OIWSEC_sha, CALG_SHA, sha, NULL },
689 { 1, szOID_RSA_MD5, CALG_MD5, md5, NULL },
690 { 1, szOID_RSA_MD4, CALG_MD4, md4, NULL },
691 { 1, szOID_RSA_MD2, CALG_MD2, md2, NULL },
693 { 2, szOID_OIWSEC_desCBC, CALG_DES, des, NULL },
694 { 2, szOID_RSA_DES_EDE3_CBC, CALG_3DES, tripledes, NULL },
695 { 2, szOID_RSA_RC2CBC, CALG_RC2, rc2, NULL },
696 { 2, szOID_RSA_RC4, CALG_RC4, rc4, NULL },
697 { 2, szOID_RSA_SMIMEalgCMS3DESwrap, CALG_3DES, cms3deswrap, NULL },
698 { 2, szOID_RSA_SMIMEalgCMSRC2wrap, CALG_RC2, cmsrc2wrap, NULL },
700 { 3, szOID_RSA_RSA, CALG_RSA_KEYX, RSA, NULL },
701 { 3, szOID_X957_DSA, CALG_DSS_SIGN, DSA, &noNullBlob },
702 { 3, szOID_ANSI_X942_DH, CALG_DH_SF, DH, &noNullBlob },
703 { 3, szOID_RSA_RSA, CALG_RSA_KEYX, RSA_KEYX, NULL },
704 { 3, szOID_RSA_RSA, CALG_RSA_SIGN, RSA, NULL },
705 { 3, szOID_RSA_RSA, CALG_RSA_SIGN, RSA_SIGN, NULL },
706 { 3, szOID_OIWSEC_dsa, CALG_DSS_SIGN, DSA, &noNullBlob },
707 { 3, szOID_OIWSEC_dsa, CALG_DSS_SIGN, DSS, &noNullBlob },
708 { 3, szOID_OIWSEC_dsa, CALG_DSS_SIGN, DSA_SIGN, &noNullBlob },
709 { 3, szOID_RSA_DH, CALG_DH_SF, DH, &noNullBlob },
710 { 3, szOID_OIWSEC_rsaXchg, CALG_RSA_KEYX, RSA_KEYX, NULL },
711 { 3, szOID_INFOSEC_mosaicKMandUpdSig, CALG_DSS_SIGN, mosaicKMandUpdSig,
713 { 3, szOID_RSA_SMIMEalgESDH, CALG_DH_EPHEM, ESDH, &noNullBlob },
714 { 3, szOID_PKIX_NO_SIGNATURE, CALG_NO_SIGN, NO_SIGN, NULL },
716 { 4, szOID_RSA_SHA1RSA, CALG_SHA1, sha1RSA, &rsaSignBlob },
717 { 4, szOID_RSA_MD5RSA, CALG_MD5, md5RSA, &rsaSignBlob },
718 { 4, szOID_X957_SHA1DSA, CALG_SHA1, sha1DSA, &dssSignBlob },
719 { 4, szOID_OIWSEC_sha1RSASign, CALG_SHA1, sha1RSA, &rsaSignBlob },
720 { 4, szOID_OIWSEC_sha1RSASign, CALG_SHA1, shaRSA, &rsaSignBlob },
721 { 4, szOID_OIWSEC_shaRSA, CALG_SHA1, shaRSA, &rsaSignBlob },
722 { 4, szOID_OIWSEC_md5RSA, CALG_MD5, md5RSA, &rsaSignBlob },
723 { 4, szOID_RSA_MD2RSA, CALG_MD2, md2RSA, &rsaSignBlob },
724 { 4, szOID_RSA_MD4RSA, CALG_MD4, md4RSA, &rsaSignBlob },
725 { 4, szOID_OIWSEC_md4RSA, CALG_MD4, md4RSA, &rsaSignBlob },
726 { 4, szOID_OIWSEC_md4RSA2, CALG_MD4, md4RSA, &rsaSignBlob },
727 { 4, szOID_OIWDIR_md2RSA, CALG_MD2, md2RSA, &rsaSignBlob },
728 { 4, szOID_OIWSEC_shaDSA, CALG_SHA1, sha1DSA, &dssSignBlob },
729 { 4, szOID_OIWSEC_shaDSA, CALG_SHA1, shaDSA, &dssSignBlob },
730 { 4, szOID_OIWSEC_dsaSHA1, CALG_SHA1, dsaSHA1, &dssSignBlob },
731 { 4, szOID_INFOSEC_mosaicUpdatedSig, CALG_SHA1, mosaicUpdatedSig,
734 { 5, szOID_COMMON_NAME, 0, CN, NULL },
735 { 5, szOID_LOCALITY_NAME, 0, L, NULL },
736 { 5, szOID_ORGANIZATION_NAME, 0, O, NULL },
737 { 5, szOID_ORGANIZATIONAL_UNIT_NAME, 0, OU, NULL },
738 { 5, szOID_RSA_emailAddr, 0, E, &ia5StringBlob },
739 { 5, szOID_RSA_emailAddr, 0, Email, &ia5StringBlob },
740 { 5, szOID_COUNTRY_NAME, 0, C, &printableStringBlob },
741 { 5, szOID_STATE_OR_PROVINCE_NAME, 0, S, NULL },
742 { 5, szOID_STATE_OR_PROVINCE_NAME, 0, ST, NULL },
743 { 5, szOID_STREET_ADDRESS, 0, STREET, NULL },
744 { 5, szOID_TITLE, 0, T, NULL },
745 { 5, szOID_TITLE, 0, Title, NULL },
746 { 5, szOID_GIVEN_NAME, 0, G, NULL },
747 { 5, szOID_GIVEN_NAME, 0, GN, NULL },
748 { 5, szOID_GIVEN_NAME, 0, GivenName, NULL },
749 { 5, szOID_INITIALS, 0, I, NULL },
750 { 5, szOID_INITIALS, 0, Initials, NULL },
751 { 5, szOID_SUR_NAME, 0, SN, NULL },
752 { 5, szOID_DOMAIN_COMPONENT, 0, DC, &domainCompTypesBlob },
753 { 5, szOID_DESCRIPTION, 0, Description, NULL },
754 { 5, szOID_POSTAL_CODE, 0, PostalCode, NULL },
755 { 5, szOID_POST_OFFICE_BOX, 0, POBox, NULL },
756 { 5, szOID_TELEPHONE_NUMBER, 0, Phone, &printableStringBlob },
757 { 5, szOID_X21_ADDRESS, 0, X21Address, &numericStringBlob },
758 { 5, szOID_DN_QUALIFIER, 0, dnQualifier, NULL },
760 { 6, szOID_AUTHORITY_KEY_IDENTIFIER2, 0, (LPCWSTR)IDS_AUTHORITY_KEY_ID, NULL },
761 { 6, szOID_AUTHORITY_KEY_IDENTIFIER, 0, (LPCWSTR)IDS_AUTHORITY_KEY_ID, NULL },
762 { 6, szOID_KEY_ATTRIBUTES, 0, (LPCWSTR)IDS_KEY_ATTRIBUTES, NULL },
763 { 6, szOID_KEY_USAGE_RESTRICTION, 0, (LPCWSTR)IDS_KEY_USAGE_RESTRICTION, NULL },
764 { 6, szOID_SUBJECT_ALT_NAME2, 0, (LPCWSTR)IDS_SUBJECT_ALT_NAME, NULL },
765 { 6, szOID_SUBJECT_ALT_NAME, 0, (LPCWSTR)IDS_SUBJECT_ALT_NAME, NULL },
766 { 6, szOID_ISSUER_ALT_NAME2, 0, (LPCWSTR)IDS_ISSUER_ALT_NAME, NULL },
767 { 6, szOID_ISSUER_ALT_NAME2, 0, (LPCWSTR)IDS_ISSUER_ALT_NAME, NULL },
768 { 6, szOID_BASIC_CONSTRAINTS2, 0, (LPCWSTR)IDS_BASIC_CONSTRAINTS, NULL },
769 { 6, szOID_BASIC_CONSTRAINTS, 0, (LPCWSTR)IDS_BASIC_CONSTRAINTS, NULL },
770 { 6, szOID_KEY_USAGE, 0, (LPCWSTR)IDS_KEY_USAGE, NULL },
771 { 6, szOID_CERT_POLICIES, 0, (LPCWSTR)IDS_CERT_POLICIES, NULL },
772 { 6, szOID_SUBJECT_KEY_IDENTIFIER, 0, (LPCWSTR)IDS_SUBJECT_KEY_IDENTIFIER, NULL },
773 { 6, szOID_CRL_REASON_CODE, 0, (LPCWSTR)IDS_CRL_REASON_CODE, NULL },
774 { 6, szOID_CRL_DIST_POINTS, 0, (LPCWSTR)IDS_CRL_DIST_POINTS, NULL },
775 { 6, szOID_ENHANCED_KEY_USAGE, 0, (LPCWSTR)IDS_ENHANCED_KEY_USAGE, NULL },
776 { 6, szOID_AUTHORITY_INFO_ACCESS, 0, (LPCWSTR)IDS_AUTHORITY_INFO_ACCESS, NULL },
777 { 6, szOID_CERT_EXTENSIONS, 0, (LPCWSTR)IDS_CERT_EXTENSIONS, NULL },
778 { 6, szOID_RSA_certExtensions, 0, (LPCWSTR)IDS_CERT_EXTENSIONS, NULL },
779 { 6, szOID_NEXT_UPDATE_LOCATION, 0, (LPCWSTR)IDS_NEXT_UPDATE_LOCATION, NULL },
780 { 6, szOID_YESNO_TRUST_ATTR, 0, (LPCWSTR)IDS_YES_OR_NO_TRUST, NULL },
781 { 6, szOID_RSA_emailAddr, 0, (LPCWSTR)IDS_EMAIL_ADDRESS, NULL },
782 { 6, szOID_RSA_unstructName, 0, (LPCWSTR)IDS_UNSTRUCTURED_NAME, NULL },
783 { 6, szOID_RSA_contentType, 0, (LPCWSTR)IDS_CONTENT_TYPE, NULL },
784 { 6, szOID_RSA_messageDigest, 0, (LPCWSTR)IDS_MESSAGE_DIGEST, NULL },
785 { 6, szOID_RSA_signingTime, 0, (LPCWSTR)IDS_SIGNING_TIME, NULL },
786 { 6, szOID_RSA_counterSign, 0, (LPCWSTR)IDS_COUNTER_SIGN, NULL },
787 { 6, szOID_RSA_challengePwd, 0, (LPCWSTR)IDS_CHALLENGE_PASSWORD, NULL },
788 { 6, szOID_RSA_unstructAddr, 0, (LPCWSTR)IDS_UNSTRUCTURED_ADDRESS, NULL },
789 { 6, szOID_RSA_SMIMECapabilities, 0, (LPCWSTR)IDS_SMIME_CAPABILITIES, NULL },
790 { 6, szOID_RSA_preferSignedData, 0, (LPCWSTR)IDS_PREFER_SIGNED_DATA, NULL },
791 { 6, szOID_PKIX_POLICY_QUALIFIER_CPS, 0, (LPCWSTR)IDS_CPS, NULL },
792 { 6, szOID_PKIX_POLICY_QUALIFIER_USERNOTICE, 0, (LPCWSTR)IDS_USER_NOTICE, NULL },
793 { 6, szOID_PKIX_OCSP, 0, (LPCWSTR)IDS_OCSP, NULL },
794 { 6, szOID_PKIX_CA_ISSUERS, 0, (LPCWSTR)IDS_CA_ISSUER, NULL },
795 { 6, szOID_ENROLL_CERTTYPE_EXTENSION, 0, (LPCWSTR)IDS_CERT_TEMPLATE_NAME, NULL },
796 { 6, szOID_ENROLL_CERTTYPE_EXTENSION, 0, (LPCWSTR)IDS_CERT_TYPE, NULL },
797 { 6, szOID_CERT_MANIFOLD, 0, (LPCWSTR)IDS_CERT_MANIFOLD, NULL },
798 { 6, szOID_NETSCAPE_CERT_TYPE, 0, (LPCWSTR)IDS_NETSCAPE_CERT_TYPE, NULL },
799 { 6, szOID_NETSCAPE_BASE_URL, 0, (LPCWSTR)IDS_NETSCAPE_BASE_URL, NULL },
800 { 6, szOID_NETSCAPE_REVOCATION_URL, 0, (LPCWSTR)IDS_NETSCAPE_REVOCATION_URL, NULL },
801 { 6, szOID_NETSCAPE_CA_REVOCATION_URL, 0, (LPCWSTR)IDS_NETSCAPE_CA_REVOCATION_URL, NULL },
802 { 6, szOID_NETSCAPE_CERT_RENEWAL_URL, 0, (LPCWSTR)IDS_NETSCAPE_CERT_RENEWAL_URL, NULL },
803 { 6, szOID_NETSCAPE_CA_POLICY_URL, 0, (LPCWSTR)IDS_NETSCAPE_CA_POLICY_URL, NULL },
804 { 6, szOID_NETSCAPE_SSL_SERVER_NAME, 0, (LPCWSTR)IDS_NETSCAPE_SSL_SERVER_NAME, NULL },
805 { 6, szOID_NETSCAPE_COMMENT, 0, (LPCWSTR)IDS_NETSCAPE_COMMENT, NULL },
806 { 6, "1.3.6.1.4.1.311.2.1.10", 0, (LPCWSTR)IDS_SPC_SP_AGENCY_INFO, NULL },
807 { 6, "1.3.6.1.4.1.311.2.1.27", 0, (LPCWSTR)IDS_SPC_FINANCIAL_CRITERIA, NULL },
808 { 6, "1.3.6.1.4.1.311.2.1.26", 0, (LPCWSTR)IDS_SPC_MINIMAL_CRITERIA, NULL },
809 { 6, szOID_COUNTRY_NAME, 0, (LPCWSTR)IDS_COUNTRY, NULL },
810 { 6, szOID_ORGANIZATION_NAME, 0, (LPCWSTR)IDS_ORGANIZATION, NULL },
811 { 6, szOID_ORGANIZATIONAL_UNIT_NAME, 0, (LPCWSTR)IDS_ORGANIZATIONAL_UNIT, NULL },
812 { 6, szOID_COMMON_NAME, 0, (LPCWSTR)IDS_COMMON_NAME, NULL },
813 { 6, szOID_LOCALITY_NAME, 0, (LPCWSTR)IDS_LOCALITY, NULL },
814 { 6, szOID_STATE_OR_PROVINCE_NAME, 0, (LPCWSTR)IDS_STATE_OR_PROVINCE, NULL },
815 { 6, szOID_TITLE, 0, (LPCWSTR)IDS_TITLE, NULL },
816 { 6, szOID_GIVEN_NAME, 0, (LPCWSTR)IDS_GIVEN_NAME, NULL },
817 { 6, szOID_INITIALS, 0, (LPCWSTR)IDS_INITIALS, NULL },
818 { 6, szOID_SUR_NAME, 0, (LPCWSTR)IDS_SUR_NAME, NULL },
819 { 6, szOID_DOMAIN_COMPONENT, 0, (LPCWSTR)IDS_DOMAIN_COMPONENT, NULL },
820 { 6, szOID_STREET_ADDRESS, 0, (LPCWSTR)IDS_STREET_ADDRESS, NULL },
821 { 6, szOID_DEVICE_SERIAL_NUMBER, 0, (LPCWSTR)IDS_SERIAL_NUMBER, NULL },
822 { 6, szOID_CERTSRV_CA_VERSION, 0, (LPCWSTR)IDS_CA_VERSION, NULL },
823 { 6, szOID_CERTSRV_CROSSCA_VERSION, 0, (LPCWSTR)IDS_CROSS_CA_VERSION, NULL },
824 { 6, szOID_SERIALIZED, 0, (LPCWSTR)IDS_SERIALIZED_SIG_SERIAL_NUMBER, NULL },
825 { 6, szOID_NT_PRINCIPAL_NAME, 0, (LPCWSTR)IDS_PRINCIPAL_NAME, NULL },
826 { 6, szOID_PRODUCT_UPDATE, 0, (LPCWSTR)IDS_WINDOWS_PRODUCT_UPDATE, NULL },
827 { 6, szOID_ENROLLMENT_NAME_VALUE_PAIR, 0, (LPCWSTR)IDS_ENROLLMENT_NAME_VALUE_PAIR, NULL },
828 { 6, szOID_OS_VERSION, 0, (LPCWSTR)IDS_OS_VERSION, NULL },
829 { 6, szOID_ENROLLMENT_CSP_PROVIDER, 0, (LPCWSTR)IDS_ENROLLMENT_CSP, NULL },
830 { 6, szOID_CRL_NUMBER, 0, (LPCWSTR)IDS_CRL_NUMBER, NULL },
831 { 6, szOID_DELTA_CRL_INDICATOR, 0, (LPCWSTR)IDS_DELTA_CRL_INDICATOR, NULL },
832 { 6, szOID_ISSUING_DIST_POINT, 0, (LPCWSTR)IDS_ISSUING_DIST_POINT, NULL },
833 { 6, szOID_FRESHEST_CRL, 0, (LPCWSTR)IDS_FRESHEST_CRL, NULL },
834 { 6, szOID_NAME_CONSTRAINTS, 0, (LPCWSTR)IDS_NAME_CONSTRAINTS, NULL },
835 { 6, szOID_POLICY_MAPPINGS, 0, (LPCWSTR)IDS_POLICY_MAPPINGS, NULL },
836 { 6, szOID_LEGACY_POLICY_MAPPINGS, 0, (LPCWSTR)IDS_POLICY_MAPPINGS, NULL },
837 { 6, szOID_POLICY_CONSTRAINTS, 0, (LPCWSTR)IDS_POLICY_CONSTRAINTS, NULL },
838 { 6, szOID_CROSS_CERT_DIST_POINTS, 0, (LPCWSTR)IDS_CROSS_CERT_DIST_POINTS, NULL },
839 { 6, szOID_APPLICATION_CERT_POLICIES, 0, (LPCWSTR)IDS_APPLICATION_POLICIES, NULL },
840 { 6, szOID_APPLICATION_POLICY_MAPPINGS, 0, (LPCWSTR)IDS_APPLICATION_POLICY_MAPPINGS, NULL },
841 { 6, szOID_APPLICATION_POLICY_CONSTRAINTS, 0, (LPCWSTR)IDS_APPLICATION_POLICY_CONSTRAINTS, NULL },
842 { 6, szOID_CT_PKI_DATA, 0, (LPCWSTR)IDS_CMC_DATA, NULL },
843 { 6, szOID_CT_PKI_RESPONSE, 0, (LPCWSTR)IDS_CMC_RESPONSE, NULL },
844 { 6, szOID_CMC, 0, (LPCWSTR)IDS_UNSIGNED_CMC_REQUEST, NULL },
845 { 6, szOID_CMC_STATUS_INFO, 0, (LPCWSTR)IDS_CMC_STATUS_INFO, NULL },
846 { 6, szOID_CMC_ADD_EXTENSIONS, 0, (LPCWSTR)IDS_CMC_EXTENSIONS, NULL },
847 { 6, szOID_CTL, 0, (LPCWSTR)IDS_CMC_ATTRIBUTES, NULL },
848 { 6, szOID_RSA_data, 0, (LPCWSTR)IDS_PKCS_7_DATA, NULL },
849 { 6, szOID_RSA_signedData, 0, (LPCWSTR)IDS_PKCS_7_SIGNED, NULL },
850 { 6, szOID_RSA_envelopedData, 0, (LPCWSTR)IDS_PKCS_7_ENVELOPED, NULL },
851 { 6, szOID_RSA_signEnvData, 0, (LPCWSTR)IDS_PKCS_7_SIGNED_ENVELOPED, NULL },
852 { 6, szOID_RSA_digestedData, 0, (LPCWSTR)IDS_PKCS_7_DIGESTED, NULL },
853 { 6, szOID_RSA_encryptedData, 0, (LPCWSTR)IDS_PKCS_7_ENCRYPTED, NULL },
854 { 6, szOID_CERTSRV_PREVIOUS_CERT_HASH, 0, (LPCWSTR)IDS_PREVIOUS_CA_CERT_HASH, NULL },
855 { 6, szOID_CRL_VIRTUAL_BASE, 0, (LPCWSTR)IDS_CRL_VIRTUAL_BASE, NULL },
856 { 6, szOID_CRL_NEXT_PUBLISH, 0, (LPCWSTR)IDS_CRL_NEXT_PUBLISH, NULL },
857 { 6, szOID_KP_CA_EXCHANGE, 0, (LPCWSTR)IDS_CA_EXCHANGE, NULL },
858 { 6, szOID_KP_KEY_RECOVERY_AGENT, 0, (LPCWSTR)IDS_KEY_RECOVERY_AGENT, NULL },
859 { 6, szOID_CERTIFICATE_TEMPLATE, 0, (LPCWSTR)IDS_CERTIFICATE_TEMPLATE, NULL },
860 { 6, szOID_ENTERPRISE_OID_ROOT, 0, (LPCWSTR)IDS_ENTERPRISE_ROOT_OID, NULL },
861 { 6, szOID_RDN_DUMMY_SIGNER, 0, (LPCWSTR)IDS_RDN_DUMMY_SIGNER, NULL },
862 { 6, szOID_ARCHIVED_KEY_ATTR, 0, (LPCWSTR)IDS_ARCHIVED_KEY_ATTR, NULL },
863 { 6, szOID_CRL_SELF_CDP, 0, (LPCWSTR)IDS_CRL_SELF_CDP, NULL },
864 { 6, szOID_REQUIRE_CERT_CHAIN_POLICY, 0, (LPCWSTR)IDS_REQUIRE_CERT_CHAIN_POLICY, NULL },
865 { 6, szOID_CMC_TRANSACTION_ID, 0, (LPCWSTR)IDS_TRANSACTION_ID, NULL },
866 { 6, szOID_CMC_SENDER_NONCE, 0, (LPCWSTR)IDS_SENDER_NONCE, NULL },
867 { 6, szOID_CMC_RECIPIENT_NONCE, 0, (LPCWSTR)IDS_RECIPIENT_NONCE, NULL },
868 { 6, szOID_CMC_REG_INFO, 0, (LPCWSTR)IDS_REG_INFO, NULL },
869 { 6, szOID_CMC_GET_CERT, 0, (LPCWSTR)IDS_GET_CERTIFICATE, NULL },
870 { 6, szOID_CMC_GET_CRL, 0, (LPCWSTR)IDS_GET_CRL, NULL },
871 { 6, szOID_CMC_REVOKE_REQUEST, 0, (LPCWSTR)IDS_REVOKE_REQUEST, NULL },
872 { 6, szOID_CMC_QUERY_PENDING, 0, (LPCWSTR)IDS_QUERY_PENDING, NULL },
873 { 6, szOID_SORTED_CTL, 0, (LPCWSTR)IDS_SORTED_CTL, NULL },
874 { 6, szOID_ARCHIVED_KEY_CERT_HASH, 0, (LPCWSTR)IDS_ARCHIVED_KEY_CERT_HASH, NULL },
875 { 6, szOID_PRIVATEKEY_USAGE_PERIOD, 0, (LPCWSTR)IDS_PRIVATE_KEY_USAGE_PERIOD, NULL },
876 { 6, szOID_REQUEST_CLIENT_INFO, 0, (LPCWSTR)IDS_CLIENT_INFORMATION, NULL },
878 { 7, szOID_PKIX_KP_SERVER_AUTH, 0, (LPCWSTR)IDS_SERVER_AUTHENTICATION, NULL },
879 { 7, szOID_PKIX_KP_CLIENT_AUTH, 0, (LPCWSTR)IDS_CLIENT_AUTHENTICATION, NULL },
880 { 7, szOID_PKIX_KP_CODE_SIGNING, 0, (LPCWSTR)IDS_CODE_SIGNING, NULL },
881 { 7, szOID_PKIX_KP_EMAIL_PROTECTION, 0, (LPCWSTR)IDS_SECURE_EMAIL, NULL },
882 { 7, szOID_PKIX_KP_TIMESTAMP_SIGNING, 0, (LPCWSTR)IDS_TIME_STAMPING, NULL },
883 { 7, szOID_KP_CTL_USAGE_SIGNING, 0, (LPCWSTR)IDS_MICROSOFT_TRUST_LIST_SIGNING, NULL },
884 { 7, szOID_KP_TIME_STAMP_SIGNING, 0, (LPCWSTR)IDS_MICROSOFT_TIME_STAMPING, NULL },
885 { 7, szOID_PKIX_KP_IPSEC_END_SYSTEM, 0, (LPCWSTR)IDS_IPSEC_END_SYSTEM, NULL },
886 { 7, szOID_PKIX_KP_IPSEC_TUNNEL, 0, (LPCWSTR)IDS_IPSEC_TUNNEL, NULL },
887 { 7, szOID_PKIX_KP_IPSEC_USER, 0, (LPCWSTR)IDS_IPSEC_USER, NULL },
888 { 7, szOID_KP_EFS, 0, (LPCWSTR)IDS_EFS, NULL },
889 { 7, szOID_WHQL_CRYPTO, 0, (LPCWSTR)IDS_WHQL_CRYPTO, NULL },
890 { 7, szOID_NT5_CRYPTO, 0, (LPCWSTR)IDS_NT5_CRYPTO, NULL },
891 { 7, szOID_OEM_WHQL_CRYPTO, 0, (LPCWSTR)IDS_OEM_WHQL_CRYPTO, NULL },
892 { 7, szOID_EMBEDDED_NT_CRYPTO, 0, (LPCWSTR)IDS_EMBEDDED_NT_CRYPTO, NULL },
893 { 7, szOID_LICENSES, 0, (LPCWSTR)IDS_KEY_PACK_LICENSES, NULL },
894 { 7, szOID_LICENSE_SERVER, 0, (LPCWSTR)IDS_LICENSE_SERVER, NULL },
895 { 7, szOID_KP_SMARTCARD_LOGON, 0, (LPCWSTR)IDS_SMART_CARD_LOGON, NULL },
896 { 7, szOID_DRM, 0, (LPCWSTR)IDS_DIGITAL_RIGHTS, NULL },
897 { 7, szOID_KP_QUALIFIED_SUBORDINATION, 0, (LPCWSTR)IDS_QUALIFIED_SUBORDINATION, NULL },
898 { 7, szOID_KP_KEY_RECOVERY, 0, (LPCWSTR)IDS_KEY_RECOVERY, NULL },
899 { 7, szOID_KP_DOCUMENT_SIGNING, 0, (LPCWSTR)IDS_DOCUMENT_SIGNING, NULL },
900 { 7, szOID_IPSEC_KP_IKE_INTERMEDIATE, 0, (LPCWSTR)IDS_IPSEC_IKE_INTERMEDIATE, NULL },
901 { 7, szOID_EFS_RECOVERY, 0, (LPCWSTR)IDS_FILE_RECOVERY, NULL },
902 { 7, szOID_ROOT_LIST_SIGNER, 0, (LPCWSTR)IDS_ROOT_LIST_SIGNER, NULL },
903 { 7, szOID_ANY_APPLICATION_POLICY, 0, (LPCWSTR)IDS_ANY_APPLICATION_POLICIES, NULL },
904 { 7, szOID_DS_EMAIL_REPLICATION, 0, (LPCWSTR)IDS_DS_EMAIL_REPLICATION, NULL },
905 { 7, szOID_ENROLLMENT_AGENT, 0, (LPCWSTR)IDS_ENROLLMENT_AGENT, NULL },
906 { 7, szOID_KP_KEY_RECOVERY_AGENT, 0, (LPCWSTR)IDS_KEY_RECOVERY_AGENT, NULL },
907 { 7, szOID_KP_CA_EXCHANGE, 0, (LPCWSTR)IDS_CA_EXCHANGE, NULL },
908 { 7, szOID_KP_LIFETIME_SIGNING, 0, (LPCWSTR)IDS_LIFETIME_SIGNING, NULL },
910 { 8, szOID_ANY_CERT_POLICY, 0, (LPCWSTR)IDS_ANY_CERT_POLICY, NULL },
918 static void init_oid_info(HINSTANCE hinst)
922 InitializeCriticalSection(&oidInfoCS);
924 for (i = 0; i < sizeof(oidInfoConstructors) /
925 sizeof(oidInfoConstructors[0]); i++)
927 if (HIWORD(oidInfoConstructors[i].pwszName))
929 struct OIDInfo *info;
931 /* The name is a static string, so just use the same pointer */
932 info = CryptMemAlloc(sizeof(struct OIDInfo));
935 memset(info, 0, sizeof(*info));
936 info->info.cbSize = sizeof(CRYPT_OID_INFO);
937 info->info.pszOID = oidInfoConstructors[i].pszOID;
938 info->info.pwszName = oidInfoConstructors[i].pwszName;
939 info->info.dwGroupId = oidInfoConstructors[i].dwGroupId;
940 info->info.Algid = oidInfoConstructors[i].Algid;
941 if (oidInfoConstructors[i].blob)
943 info->info.ExtraInfo.cbData =
944 oidInfoConstructors[i].blob->cbData;
945 info->info.ExtraInfo.pbData =
946 oidInfoConstructors[i].blob->pbData;
948 list_add_tail(&oidInfo, &info->entry);
953 int len = LoadStringW(hinst, (UINT)oidInfoConstructors[i].pwszName,
958 struct OIDInfo *info = CryptMemAlloc(sizeof(struct OIDInfo) +
959 (len + 1) * sizeof(WCHAR));
963 memset(info, 0, sizeof(*info));
964 info->info.cbSize = sizeof(CRYPT_OID_INFO);
965 info->info.pszOID = oidInfoConstructors[i].pszOID;
966 info->info.pwszName =
967 (LPWSTR)((LPBYTE)info + sizeof(struct OIDInfo));
968 info->info.dwGroupId = oidInfoConstructors[i].dwGroupId;
969 info->info.Algid = oidInfoConstructors[i].Algid;
970 LoadStringW(hinst, (UINT)oidInfoConstructors[i].pwszName,
971 (LPWSTR)info->info.pwszName, len + 1);
972 if (oidInfoConstructors[i].blob)
974 info->info.ExtraInfo.cbData =
975 oidInfoConstructors[i].blob->cbData;
976 info->info.ExtraInfo.pbData =
977 oidInfoConstructors[i].blob->pbData;
979 list_add_tail(&oidInfo, &info->entry);
986 static void free_oid_info(void)
988 struct OIDInfo *info, *next;
990 LIST_FOR_EACH_ENTRY_SAFE(info, next, &oidInfo, struct OIDInfo, entry)
992 list_remove(&info->entry);
995 DeleteCriticalSection(&oidInfoCS);
998 BOOL WINAPI CryptEnumOIDInfo(DWORD dwGroupId, DWORD dwFlags, void *pvArg,
999 PFN_CRYPT_ENUM_OID_INFO pfnEnumOIDInfo)
1002 struct OIDInfo *info;
1004 TRACE("(%ld, %08lx, %p, %p)\n", dwGroupId, dwFlags, pvArg,
1007 EnterCriticalSection(&oidInfoCS);
1008 LIST_FOR_EACH_ENTRY(info, &oidInfo, struct OIDInfo, entry)
1010 if (!dwGroupId || dwGroupId == info->info.dwGroupId)
1012 ret = pfnEnumOIDInfo(&info->info, pvArg);
1017 LeaveCriticalSection(&oidInfoCS);
1021 PCCRYPT_OID_INFO WINAPI CryptFindOIDInfo(DWORD dwKeyType, void *pvKey,
1024 PCCRYPT_OID_INFO ret = NULL;
1026 TRACE("(%ld, %p, %ld)\n", dwKeyType, pvKey, dwGroupId);
1030 case CRYPT_OID_INFO_ALGID_KEY:
1032 struct OIDInfo *info;
1034 EnterCriticalSection(&oidInfoCS);
1035 LIST_FOR_EACH_ENTRY(info, &oidInfo, struct OIDInfo, entry)
1037 if (info->info.Algid == *(DWORD *)pvKey &&
1038 (!dwGroupId || info->info.dwGroupId == dwGroupId))
1044 LeaveCriticalSection(&oidInfoCS);
1047 case CRYPT_OID_INFO_NAME_KEY:
1049 struct OIDInfo *info;
1051 EnterCriticalSection(&oidInfoCS);
1052 LIST_FOR_EACH_ENTRY(info, &oidInfo, struct OIDInfo, entry)
1054 if (!lstrcmpW(info->info.pwszName, (LPWSTR)pvKey) &&
1055 (!dwGroupId || info->info.dwGroupId == dwGroupId))
1061 LeaveCriticalSection(&oidInfoCS);
1064 case CRYPT_OID_INFO_OID_KEY:
1066 struct OIDInfo *info;
1067 LPSTR oid = (LPSTR)pvKey;
1069 EnterCriticalSection(&oidInfoCS);
1070 LIST_FOR_EACH_ENTRY(info, &oidInfo, struct OIDInfo, entry)
1072 if (!lstrcmpA(info->info.pszOID, oid) &&
1073 (!dwGroupId || info->info.dwGroupId == dwGroupId))
1079 LeaveCriticalSection(&oidInfoCS);
1082 case CRYPT_OID_INFO_SIGN_KEY:
1084 struct OIDInfo *info;
1086 EnterCriticalSection(&oidInfoCS);
1087 LIST_FOR_EACH_ENTRY(info, &oidInfo, struct OIDInfo, entry)
1089 if (info->info.Algid == *(DWORD *)pvKey &&
1090 info->info.ExtraInfo.cbData >= sizeof(DWORD) &&
1091 *(DWORD *)info->info.ExtraInfo.pbData ==
1092 *(DWORD *)((LPBYTE)pvKey + sizeof(DWORD)) &&
1093 (!dwGroupId || info->info.dwGroupId == dwGroupId))
1099 LeaveCriticalSection(&oidInfoCS);
1106 LPCSTR WINAPI CertAlgIdToOID(DWORD dwAlgId)
1109 PCCRYPT_OID_INFO info = CryptFindOIDInfo(CRYPT_OID_INFO_ALGID_KEY,
1119 DWORD WINAPI CertOIDToAlgId(LPCSTR pszObjId)
1122 PCCRYPT_OID_INFO info = CryptFindOIDInfo(CRYPT_OID_INFO_OID_KEY,
1123 (void *)pszObjId, 0);