got a lot of crypt32 stuff working
authorChristoph von Wittich <christoph_vw@reactos.org>
Fri, 18 Nov 2005 02:08:46 +0000 (02:08 +0000)
committerChristoph von Wittich <christoph_vw@reactos.org>
Fri, 18 Nov 2005 02:08:46 +0000 (02:08 +0000)
svn path=/trunk/; revision=19320

reactos/baseaddress.xml
reactos/lib/advapi32/advapi32.def
reactos/lib/crypt32/cert.c
reactos/lib/crypt32/crypt32.def
reactos/lib/crypt32/crypt32.xml
reactos/lib/crypt32/crypt32_private.h
reactos/lib/crypt32/encode.c
reactos/lib/crypt32/precomp.h
reactos/w32api/include/wincrypt.h

index d4e5fba..1d89fb3 100644 (file)
 <property name="BASEADDRESS_OLE32" value="0x77a50000" />
 <property name="BASEADDRESS_WS2_32" value="0x77aa0000" />
 <property name="BASEADDRESS_OLEPRO32" value="0x77aa0000" />
-<property name="BASEADDRESS_CRYPT32" value="0x77aa1000" />
+<property name="BASEADDRESS_CRYPT32" value="0x77ab0000" />
 <property name="BASEADDRESS_ADVAPI32" value="0x77dc0000" />
 <property name="BASEADDRESS_USER32" value="0x77e50000" />
 <property name="BASEADDRESS_GDI32" value="0x77f10000" />
index 22083fc..e2edf15 100644 (file)
@@ -176,7 +176,7 @@ CryptSetProviderA@8
 ;CryptSetProviderExW@16
 CryptSetProviderW@8
 CryptSignHashA@24
-;CryptSignHashW@24
+CryptSignHashW@24
 CryptVerifySignatureA@24
 CryptVerifySignatureW@24
 DecryptFileA@8
index 321c47a..cdcd322 100644 (file)
 
 #include "precomp.h"
 
+#define NONAMELESSUNION
+
+static _SEH_FILTER(page_fault)
+{
+    if (_SEH_GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION)
+        return _SEH_EXECUTE_HANDLER;
+    return _SEH_CONTINUE_SEARCH;
+}
+
 WINE_DEFAULT_DEBUG_CHANNEL(crypt);
 
 #define WINE_CRYPTCERTSTORE_MAGIC 0x74726563
@@ -304,12 +313,14 @@ static const void * WINAPI CRYPT_ReadSerializedElement(const BYTE *pbElement,
  DWORD cbElement, DWORD dwContextTypeFlags, DWORD *pdwContentType);
 
 /* filter for page-fault exceptions */
+/*
 static WINE_EXCEPTION_FILTER(page_fault)
 {
     if (GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION)
         return EXCEPTION_EXECUTE_HANDLER;
     return EXCEPTION_CONTINUE_SEARCH;
 }
+*/
 
 static void CRYPT_InitStore(WINECRYPT_CERTSTORE *store, HCRYPTPROV hCryptProv,
  DWORD dwFlags, CertStoreType type)
@@ -330,6 +341,7 @@ static void CRYPT_InitStore(WINECRYPT_CERTSTORE *store, HCRYPTPROV hCryptProv,
  * be a PWINE_CERT_CONTEXT, and increments pCertContext's reference count.
  * Also sets the hCertStore member of the reference to store.
  */
+
 static void CRYPT_InitCertRef(PWINE_CERT_CONTEXT_REF ref,
  PWINE_CERT_CONTEXT context, HCERTSTORE store)
 {
@@ -3301,6 +3313,15 @@ BOOL WINAPI CryptVerifyCertificateSignatureEx(HCRYPTPROV hCryptProv,
     return ret;
 }
 
+BOOL WINAPI CryptEncryptMessage( PCRYPT_ENCRYPT_MESSAGE_PARA pEncryptMessagePara,
+                                 DWORD dwCert, PCCERT_CONTEXT pccertCert[],
+                                 const BYTE* pbEncrypted, DWORD dwEncrypted,
+                                 BYTE* pbBlob, DWORD* dwEncryptedBlob)
+{
+    UNIMPLEMENTED;
+    return FALSE;
+}
+
 HCRYPTOIDFUNCSET WINAPI CryptInitOIDFunctionSet(LPCSTR pszFuncName, DWORD dwFlags)
 {
     FIXME("stub: %s %lx\n", debugstr_a(pszFuncName), dwFlags);
@@ -3313,3 +3334,42 @@ BOOL WINAPI CryptUnregisterDefaultOIDFunction(DWORD dwEncodingType,
     FIXME("stub: %lx %s %s\n", dwEncodingType, debugstr_a(pszFuncName), debugstr_w(pwszDll));
     return FALSE;
 }
+
+DWORD WINAPI CertGetNameStringW(PCCERT_CONTEXT pCertContext,
+                                DWORD dwType, DWORD dwFlags,
+                                LPVOID pvType, LPWSTR pszName, 
+                                DWORD dwName)
+{
+    UNIMPLEMENTED;
+    return ERROR_CALL_NOT_IMPLEMENTED;
+}
+
+DWORD WINAPI CertGetNameStringA(PCCERT_CONTEXT pCertContext, 
+                                DWORD dwType, DWORD dwFlags, 
+                                LPVOID pvType, LPSTR pszName,
+                                DWORD dwName)
+{
+    UNIMPLEMENTED;
+    return ERROR_CALL_NOT_IMPLEMENTED;
+}
+
+
+DWORD WINAPI CertNameToStrA(DWORD dwCertEncoding, 
+                            PCERT_NAME_BLOB pCertName, 
+                            DWORD dwType, LPSTR psz,
+                            DWORD dwSZ)
+{
+    UNIMPLEMENTED;
+    return ERROR_CALL_NOT_IMPLEMENTED;
+}
+
+DWORD WINAPI CertNameToStrW(DWORD dwCertEncoding,
+                            PCERT_NAME_BLOB pCertName,
+                            DWORD dwType, LPWSTR psz, 
+                            DWORD dwSZ)
+{
+    UNIMPLEMENTED;
+    return ERROR_CALL_NOT_IMPLEMENTED;
+}
+
+
index 079203b..41973d9 100644 (file)
@@ -1,10 +1,68 @@
 LIBRARY CRYPT32.DLL
 EXPORTS
 
+CertAddEncodedCRLToStore@24              @1022
+
+CertAddSerializedElementToStore@32       @1028
+CertAddStoreToCollection@16              @1029
 CertAlgIdToOID@4                         @1030
+CertCloseStore@8                         @1031
+
+CertDeleteCRLFromStore@4                 @1044
+
+CertDeleteCertificateFromStore@4         @1046
+
+CertFindAttribute@12                     @1062
+
+CertFindCertificateInStore@24            @1066
+
+CertFindExtension@12                     @1068
+CertFindRDNAttr@8                        @1069
+
+CertFreeCRLContext@4                     @1072
+CertFreeCTLContext@4                     @1073
 
+CertFreeCertificateContext@4             @1076
+
+CertGetCTLContextProperty@16             @1079
+
+CertGetCertificateContextProperty@16     @1081
+
+CertGetNameStringA@24                    @1085
+CertGetNameStringW@24                    @1086
+
+CertNameToStrA@20                        @1093
+CertNameToStrW@20                        @1094
 CertOIDToAlgId@4                         @1095
 
+CertOpenSystemStoreA@8                   @1097
+CertOpenSystemStoreW@8                   @1098
+
+CertRemoveStoreFromCollection@8          @1104
+
+CertSerializeCTLStoreElement@16          @1108
+CertSerializeCertificateStoreElement@16  @1109
+
+CertSetCTLContextProperty@16             @1111
+CertSetCertificateContextProperty@16     @1113
+
+CertVerifyTimeValidity@8                 @1126
+
+CryptDecodeObjectEx@32                   @1138
+
+CryptEncodeObject@20                     @1141
+
+CryptEncryptMessage@28                   @1143
+
+CryptExportPublicKeyInfo@20              @1149
+CryptExportPublicKeyInfoEx@32            @1150
+
+CryptGetOIDFunctionValue@28              @1163
+CryptHashCertificate@28                  @1164
+
+CryptImportPublicKeyInfo@16              @1169
+CryptImportPublicKeyInfoEx@28            @1170
+
 CryptMemAlloc@4                          @1175
 CryptMemFree@4                           @1176
 CryptMemRealloc@8                        @1177
@@ -12,6 +70,8 @@ CryptMemRealloc@8                        @1177
 CryptProtectData@28                      @1193
 
 CryptRegisterDefaultOIDFunction@16       @1195
+CryptRegisterOIDFunction@20              @1196
+
 CryptSIPAddProvider@4                    @1198
 
 CryptSIPLoad@12                          @1201
@@ -19,8 +79,17 @@ CryptSIPRemoveProvider@4                 @1203
 
 CryptSIPRetrieveSubjectGuid@12           @1205
 
+CryptSetOIDFunctionValue@28              @1210
+
+CryptSignCertificate@36                  @1214
+
 CryptUnprotectData@28                    @1221
 
+CryptUnregisterOIDFunction@12            @1223
+
+CryptVerifyCertificateSignature@20
+CryptVerifyCertificateSignatureEx@32     @1226
+
 I_CryptCreateLruCache@8                  @1240
 
 I_CryptDetachTls@4                       @1242
index 50a99d8..4146375 100644 (file)
@@ -3,11 +3,14 @@
        <include base="crypt32">.</include>
        <define name="__USE_W32API" />
        <define name="_WIN32_WINNT">0x501</define>
+       <library>pseh</library>
        <library>ntdll</library>
        <library>kernel32</library>
        <library>wine</library>
        <library>advapi32</library>
        <file>main.c</file>
+       <file>encode.c</file>
+       <file>cert.c</file>
        <file>protectdata.c</file>
        <file>crypt32.rc</file>
        <pch>precomp.h</pch>
index 9b59353..3e7e860 100644 (file)
@@ -19,6 +19,8 @@
 #ifndef __CRYPT32_PRIVATE_H__
 #define __CRYPT32_PRIVATE_H__
 
+#define STATUS_ACCESS_VIOLATION          0xC0000005
+
 /* Returns a handle to the default crypto provider; loads it if necessary.
  * Returns NULL on failure.
  */
index cd9eadd..9380431 100644 (file)
 
 #include "precomp.h"
 
+static _SEH_FILTER(page_fault)
+{
+    if (_SEH_GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION)
+        return _SEH_EXECUTE_HANDLER;
+    return _SEH_CONTINUE_SEARCH;
+}
+
 /* This is a bit arbitrary, but to set some limit: */
 #define MAX_ENCODED_LEN 0x02000000
 
 /* a few asn.1 tags we need */
 #define ASN_BOOL            (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x01)
 #define ASN_BITSTRING       (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x03)
-#define ASN_OCTETSTRING     (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x04)
+//#define ASN_OCTETSTRING     (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x04)
 #define ASN_ENUMERATED      (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x0a)
 #define ASN_SETOF           (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x11)
 #define ASN_NUMERICSTRING   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x12)
@@ -161,14 +168,6 @@ static BOOL WINAPI CRYPT_AsnDecodeUnsignedIntegerInternal(
  DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara,
  void *pvStructInfo, DWORD *pcbStructInfo);
 
-/* filter for page-fault exceptions */
-static WINE_EXCEPTION_FILTER(page_fault)
-{
-    if (GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION)
-        return EXCEPTION_EXECUTE_HANDLER;
-    return EXCEPTION_CONTINUE_SEARCH;
-}
-
 static char *CRYPT_GetKeyName(DWORD dwEncodingType, LPCSTR pszFuncName,
  LPCSTR pszOID)
 {
@@ -1491,15 +1490,15 @@ 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:
-        if (entry->u.pwszURL)
+        if (entry->pwszURL)
         {
             DWORD i;
 
             /* Not + 1: don't encode the NULL-terminator */
-            dataLen = lstrlenW(entry->u.pwszURL);
+            dataLen = lstrlenW(entry->pwszURL);
             for (i = 0; ret && i < dataLen; i++)
             {
-                if (entry->u.pwszURL[i] > 0x7f)
+                if (entry->pwszURL[i] > 0x7f)
                 {
                     SetLastError(CRYPT_E_INVALID_IA5_STRING);
                     ret = FALSE;
@@ -1511,7 +1510,7 @@ static BOOL CRYPT_AsnEncodeAltNameEntry(const CERT_ALT_NAME_ENTRY *entry,
             dataLen = 0;
         break;
     case CERT_ALT_NAME_IP_ADDRESS:
-        dataLen = entry->u.IPAddress.cbData;
+        dataLen = entry->IPAddress.cbData;
         break;
     case CERT_ALT_NAME_REGISTERED_ID:
         /* FIXME: encode OID */
@@ -1551,11 +1550,11 @@ static BOOL CRYPT_AsnEncodeAltNameEntry(const CERT_ALT_NAME_ENTRY *entry,
                 DWORD i;
 
                 for (i = 0; i < dataLen; i++)
-                    *pbEncoded++ = (BYTE)entry->u.pwszURL[i];
+                    *pbEncoded++ = (BYTE)entry->pwszURL[i];
                 break;
             }
             case CERT_ALT_NAME_IP_ADDRESS:
-                memcpy(pbEncoded, entry->u.IPAddress.pbData, dataLen);
+                memcpy(pbEncoded, entry->IPAddress.pbData, dataLen);
                 break;
             }
             if (ret)
@@ -4146,18 +4145,18 @@ static BOOL CRYPT_AsnDecodeAltNameEntry(const BYTE *pbEncoded, DWORD cbEncoded,
                     DWORD i;
 
                     for (i = 0; i < dataLen; i++)
-                        entry->u.pwszURL[i] =
+                        entry->pwszURL[i] =
                          (WCHAR)pbEncoded[1 + lenBytes + i];
-                    entry->u.pwszURL[i] = 0;
+                    entry->pwszURL[i] = 0;
                     break;
                 }
                 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.
                      */
-                    entry->u.IPAddress.pbData = (LPBYTE)entry->u.pwszURL;
-                    entry->u.IPAddress.cbData = dataLen;
-                    memcpy(entry->u.IPAddress.pbData, pbEncoded + 1 + lenBytes,
+                    entry->IPAddress.pbData = (LPBYTE)entry->pwszURL;
+                    entry->IPAddress.cbData = dataLen;
+                    memcpy(entry->IPAddress.pbData, pbEncoded + 1 + lenBytes,
                      dataLen);
                     break;
                 }
@@ -4239,7 +4238,7 @@ static BOOL WINAPI CRYPT_AsnDecodeAltName(DWORD dwCertEncodingType,
                              i < cEntry && ptr - pbEncoded - 1 - lenBytes <
                              dataLen; i++)
                             {
-                                info->rgAltEntry[i].u.pwszURL =
+                                info->rgAltEntry[i].pwszURL =
                                  (LPWSTR)nextData;
                                 size = bytesNeeded;
                                 ret = CRYPT_AsnDecodeAltNameEntry(ptr,
index b17c280..973cb90 100644 (file)
@@ -8,6 +8,7 @@
 #include <libs/pseh/pseh.h>\r
 \r
 #include "windef.h"\r
+#include "winnt.h"\r
 #include "winbase.h"\r
 #include "wincrypt.h"\r
 #include "winreg.h"\r
@@ -16,6 +17,5 @@
 #include "mssip.h"\r
 #include "crypt32_private.h"\r
 #include "wine/debug.h"\r
+#include "wine/list.h"\r
 \r
-#define NTOS_MODE_USER\r
-#include <ndk/ntndk.h>\r
index 463df7d..8e0f777 100644 (file)
@@ -111,6 +111,45 @@ typedef void *HCRYPTOIDFUNCADDR;
 #define CALG_DESX (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_DESX)
 #define CALG_TLS1PRF (ALG_CLASS_DHASH|ALG_TYPE_ANY|ALG_SID_TLS1PRF)
 
+typedef struct _CERT_PRIVATE_KEY_VALIDITY {
+    FILETIME NotBefore;
+    FILETIME NotAfter;
+} CERT_PRIVATE_KEY_VALIDITY, *PCERT_PRIVATE_KEY_VALIDITY;
+
+
+/* access state flags */
+#define CERT_ACCESS_STATE_WRITE_PERSIST_FLAG   0x1
+#define CERT_ACCESS_STATE_SYSTEM_STORE_FLAG    0x2
+#define CERT_ACCESS_STATE_LM_SYSTEM_STORE_FLAG 0x4
+
+/* CERT_RDN attribute dwValueType types */
+#define CERT_RDN_TYPE_MASK 0x000000ff
+#define CERT_RDN_ANY_TYPE         0
+#define CERT_RDN_ENCODED_BLOB     1
+#define CERT_RDN_OCTET_STRING     2
+#define CERT_RDN_NUMERIC_STRING   3
+#define CERT_RDN_PRINTABLE_STRING 4
+#define CERT_RDN_TELETEX_STRING   5
+#define CERT_RDN_T61_STRING       5
+#define CERT_RDN_VIDEOTEX_STRING  6
+#define CERT_RDN_IA5_STRING       7
+#define CERT_RDN_GRAPHIC_STRING   8
+#define CERT_RDN_VISIBLE_STRING   9
+#define CERT_RDN_ISO646_STRING    9
+#define CERT_RDN_GENERAL_STRING   10
+#define CERT_RDN_UNIVERSAL_STRING 11
+#define CERT_RDN_INT4_STRING      11
+#define CERT_RDN_BMP_STRING       12
+#define CERT_RDN_UNICODE_STRING   12
+#define CERT_RDN_UTF8_STRING      13
+
+/* CERT_RDN attribute dwValueType flags */
+#define CERT_RDN_FLAGS_MASK 0xff000000
+#define CERT_RDN_ENABLE_T61_UNICODE_FLAG  0x80000000
+#define CERT_RDN_DISABLE_CHECK_TYPE_FLAG  0x4000000
+#define CERT_RDN_ENABLE_UTF8_UNICODE_FLAG 0x2000000
+#define CERT_RDN_DISABLE_IE4_UTF8_FLAG    0x0100000
+
 /* physical store dwFlags, also used by CertAddStoreToCollection as
  * dwUpdateFlags
  */
@@ -1363,6 +1402,15 @@ typedef struct _CERT_ALT_NAME_INFO {
 typedef LPVOID (WINAPI *PFN_CRYPT_ALLOC)(size_t cbsize);
 typedef VOID   (WINAPI *PFN_CRYPT_FREE)(LPVOID pv);
 
+typedef struct _CRYPT_ENCRYPT_MESSAGE_PARA {
+    DWORD cbSize;
+    DWORD dwMsgEncodingType;
+    HCRYPTPROV hCryptProv;
+    CRYPT_ALGORITHM_IDENTIFIER ContentEncryptionAlgorithm;
+    void* pvEncryptionAuxInfo;
+    DWORD dwFlags;
+    DWORD dwInnerContentType;
+} CRYPT_ENCRYPT_MESSAGE_PARA, *PCRYPT_ENCRYPT_MESSAGE_PARA;
 typedef struct _CRYPT_DECODE_PARA {
     DWORD           cbSize;
     PFN_CRYPT_ALLOC pfnAlloc;
@@ -1512,12 +1560,22 @@ typedef struct _CERT_SIGNED_CONTENT_INFO {
     CRYPT_BIT_BLOB             Signature;
 } CERT_SIGNED_CONTENT_INFO, *PCERT_SIGNED_CONTENT_INFO;
 
+typedef struct _CERT_EXTENSIONS {
+    DWORD           cExtension;
+    PCERT_EXTENSION rgExtension;
+} CERT_EXTENSIONS, *PCERT_EXTENSIONS;
+
 typedef struct _CERT_RDN_ATTR {
     LPSTR               pszObjId;
     DWORD               dwValueType;
     CERT_RDN_VALUE_BLOB Value;
 } CERT_RDN_ATTR, *PCERT_RDN_ATTR;
 
+typedef struct _CERT_NAME_VALUE {
+    DWORD               dwValueType;
+    CERT_RDN_VALUE_BLOB Value;
+} CERT_NAME_VALUE, *PCERT_NAME_VALUE;
+
 typedef struct _CERT_RDN {
     DWORD          cRDNAttr;
     PCERT_RDN_ATTR rgRDNAttr;
@@ -1557,6 +1615,22 @@ typedef struct _CERT_STORE_PROV_INFO {
     HCRYPTOIDFUNCADDR hStoreProvFuncAddr2;
 } CERT_STORE_PROV_INFO, *PCERT_STORE_PROV_INFO;
 
+#define CERT_ALT_NAME_ENTRY_ERR_INDEX_MASK  0xff
+#define CERT_ALT_NAME_ENTRY_ERR_INDEX_SHIFT 16
+#define CERT_ALT_NAME_VALUE_ERR_INDEX_MASK  0x0000ffff
+#define CERT_ALT_NAME_VALUE_ERR_INDEX_SHIFT 0
+#define GET_CERT_ALT_NAME_ENTRY_ERR_INDEX(x) \
+ (((x) >> CERT_ALT_NAME_ENTRY_ERR_INDEX_SHIFT) & \
+  CERT_ALT_NAME_ENTRY_ERR_INDEX_MASK)
+#define GET_CERT_ALT_NAME_VALUE_ERR_INDEX(x) \
+ ((x) & CERT_ALT_NAME_VALUE_ERR_INDEX_MASK)
+
+typedef struct _CERT_BASIC_CONSTRAINTS2_INFO {
+    BOOL  fCA;
+    BOOL  fPathLenConstraint;
+    DWORD dwPathLenConstraint;
+} CERT_BASIC_CONSTRAINTS2_INFO, *PCERT_BASIC_CONSTRAINTS2_INFO;
+
 typedef BOOL (WINAPI *PFN_CERT_ENUM_SYSTEM_STORE_LOCATION)(
  LPCWSTR pwszStoreLocation, DWORD dwFlags, void *pvReserved, void *pvArg);
 
@@ -1648,7 +1722,31 @@ PCERT_RDN_ATTR WINAPI CertFindRDNAttr(LPCSTR pszObjId, PCERT_NAME_INFO pName);
 BOOL WINAPI CertSerializeCertificateStoreElement(PCCERT_CONTEXT pCertContext, DWORD dwFlags, BYTE *pbElement, DWORD *pcbElement);
 BOOL WINAPI CertSerializeCRLStoreElement(PCCRL_CONTEXT pCrlContext, DWORD dwFlags, BYTE *pbElement, DWORD *pcbElement);
 BOOL WINAPI CertSerializeCTLStoreElement(PCCTL_CONTEXT pCtlContext, DWORD dwFlags, BYTE *pbElement, DWORD *pcbElement);
-
+BOOL WINAPI CertAddCertificateContextToStore(HCERTSTORE hCertStore, PCCERT_CONTEXT pCertContext, DWORD dwAddDisposition, PCCERT_CONTEXT *ppStoreContext);
+BOOL WINAPI CertAddEncodedCertificateToStore(HCERTSTORE hCertStore, DWORD dwCertEncodingType, const BYTE *pbCertEncoded, DWORD cbCertEncoded, DWORD dwAddDisposition, PCCERT_CONTEXT *ppCertContext);
+PCCERT_CONTEXT WINAPI CertCreateCertificateContext(DWORD dwCertEncodingType, const BYTE *pbCertEncoded, DWORD cbCertEncoded);
+PCCERT_CONTEXT WINAPI CertEnumCertificatesInStore(HCERTSTORE hCertStore, PCCERT_CONTEXT pPrev);
+PCCERT_CONTEXT WINAPI CertFindCertificateInStore(HCERTSTORE,DWORD,DWORD,DWORD,const void*,PCCERT_CONTEXT);
+PCCTL_CONTEXT WINAPI CertEnumCTLsInStore(HCERTSTORE hCertStore, PCCTL_CONTEXT pPrev);
+PCCTL_CONTEXT WINAPI CertCreateCTLContext(DWORD dwMsgAndCertEncodingType, const BYTE *pbCtlEncoded, DWORD cbCtlEncoded);
+PCCRL_CONTEXT WINAPI CertCreateCRLContext( DWORD dwCertEncodingType,  const BYTE* pbCrlEncoded, DWORD cbCrlEncoded);
+PCCRL_CONTEXT WINAPI CertEnumCRLsInStore(HCERTSTORE hCertStore, PCCRL_CONTEXT pPrev);
+BOOL WINAPI CryptHashCertificate(HCRYPTPROV hCryptProv, ALG_ID Algid, DWORD dwFlags, const BYTE *pbEncoded, DWORD cbEncoded, BYTE *pbComputedHash, DWORD *pcbComputedHash);
+BOOL WINAPI CertFreeCTLContext( PCCTL_CONTEXT pCtlContext );
+BOOL WINAPI CertDeleteCTLFromStore(PCCTL_CONTEXT pCtlContext);
+BOOL WINAPI CertSetCTLContextProperty(PCCTL_CONTEXT pCTLContext, DWORD dwPropId, DWORD dwFlags, const void *pvData);
+BOOL WINAPI CertGetCTLContextProperty(PCCTL_CONTEXT pCTLContext, DWORD dwPropId, void *pvData, DWORD *pcbData);
+BOOL WINAPI CertAddCTLContextToStore( HCERTSTORE hCertStore, PCCTL_CONTEXT pCtlContext, DWORD dwAddDisposition, PCCTL_CONTEXT *ppStoreContext );
+BOOL WINAPI CertFreeCRLContext( PCCRL_CONTEXT pCrlContext );
+BOOL WINAPI CertSetCRLContextProperty(PCCRL_CONTEXT pCRLContext, DWORD dwPropId, DWORD dwFlags, const void *pvData);
+BOOL WINAPI CertDeleteCRLFromStore(PCCRL_CONTEXT pCrlContext);
+BOOL WINAPI CertAddEncodedCTLToStore(HCERTSTORE hCertStore, DWORD dwMsgAndCertEncodingType, const BYTE *pbCtlEncoded, DWORD cbCtlEncoded, DWORD dwAddDisposition, PCCTL_CONTEXT *ppCtlContext);
+BOOL WINAPI CertAddEncodedCRLToStore(HCERTSTORE hCertStore, DWORD dwCertEncodingType, const BYTE *pbCrlEncoded, DWORD cbCrlEncoded, DWORD dwAddDisposition, PCCRL_CONTEXT *ppCrlContext);
+BOOL WINAPI CertDeleteCertificateFromStore(PCCERT_CONTEXT pCertContext);
+BOOL WINAPI CertSetCertificateContextProperty(PCCERT_CONTEXT pCertContext, DWORD dwPropId, DWORD dwFlags, const void *pvData);
+BOOL WINAPI CertAddCRLContextToStore( HCERTSTORE hCertStore, PCCRL_CONTEXT pCrlContext, DWORD dwAddDisposition, PCCRL_CONTEXT *ppStoreContext );
+BOOL WINAPI CertGetCRLContextProperty(PCCRL_CONTEXT pCRLContext, DWORD dwPropId, void *pvData, DWORD *pcbData);
+BOOL WINAPI CertGetCertificateContextProperty(PCCERT_CONTEXT pCertContext, DWORD dwPropId, void *pvData, DWORD *pcbData);
 BOOL WINAPI CertCloseStore(HCERTSTORE,DWORD);
 BOOL WINAPI CertGetCertificateChain(HCERTCHAINENGINE,PCCERT_CONTEXT,LPFILETIME,HCERTSTORE,PCERT_CHAIN_PARA,DWORD,LPVOID,PCCERT_CHAIN_CONTEXT*);
 BOOL WINAPI CertVerifyCertificateChainPolicy(LPCSTR,PCCERT_CHAIN_CONTEXT,PCERT_CHAIN_POLICY_PARA,PCERT_CHAIN_POLICY_STATUS);
@@ -1657,9 +1755,12 @@ DWORD WINAPI CertNameToStrA(DWORD,PCERT_NAME_BLOB,DWORD,LPSTR,DWORD);
 DWORD WINAPI CertNameToStrW(DWORD,PCERT_NAME_BLOB,DWORD,LPWSTR,DWORD);
 HCERTSTORE WINAPI CertOpenSystemStoreA(HCRYPTPROV,LPCSTR);
 HCERTSTORE WINAPI CertOpenSystemStoreW(HCRYPTPROV,LPCWSTR);
+DWORD WINAPI CertGetNameStringW(PCCERT_CONTEXT pCertContext, DWORD dwType, DWORD dwFlags, LPVOID pvType, LPWSTR pszName, DWORD dwName);
+DWORD WINAPI CertGetNameStringA(PCCERT_CONTEXT pCertContext, DWORD dwType, DWORD dwFlags, LPVOID pvType, LPSTR pszName, DWORD dwName);
 HCERTSTORE WINAPI CertOpenStore(LPCSTR lpszStoreProvider, DWORD dwEncodingType, HCRYPTPROV hCryptProv, DWORD dwFlags, const void *pvPara);
-PCCERT_CONTEXT WINAPI CertFindCertificateInStore(HCERTSTORE,DWORD,DWORD,DWORD,const void*,PCCERT_CONTEXT);
 BOOL WINAPI CertFreeCertificateContext(PCCERT_CONTEXT);
+DWORD WINAPI CertNameToStrA(DWORD dwCertEncoding, PCERT_NAME_BLOB pCertName, DWORD dwType, LPSTR psz, DWORD dwSZ);
+DWORD WINAPI CertNameToStrW(DWORD dwCertEncoding, PCERT_NAME_BLOB pCertName, DWORD dwType, LPWSTR psz, DWORD dwSZ);
 PCCERT_CONTEXT WINAPI CertGetIssuerCertificateFromStore(HCERTSTORE,PCCERT_CONTEXT,PCCERT_CONTEXT,DWORD*);
 PCCERT_CHAIN_CONTEXT WINAPI CertFindChainInStore(HCERTSTORE,DWORD,DWORD,DWORD,const void*,PCCERT_CHAIN_CONTEXT);
 BOOL WINAPI CryptAcquireContextA(HCRYPTPROV*,LPCSTR,LPCSTR,DWORD,DWORD);
@@ -1669,6 +1770,7 @@ BOOL WINAPI CryptReleaseContext(HCRYPTPROV,DWORD);
 BOOL WINAPI CryptGenKey(HCRYPTPROV,ALG_ID,DWORD,HCRYPTKEY*);
 BOOL WINAPI CryptDeriveKey(HCRYPTPROV,ALG_ID,HCRYPTHASH,DWORD,HCRYPTKEY*);
 BOOL WINAPI CryptDestroyKey(HCRYPTKEY);
+BOOL WINAPI CryptEncryptMessage( PCRYPT_ENCRYPT_MESSAGE_PARA pEncryptMessagePara, DWORD dwCert, PCCERT_CONTEXT pccertCert[],  const BYTE* pbEncrypted, DWORD dwEncrypted, BYTE* pbBlob, DWORD* dwEncryptedBlob);
 #if (WINVER >= 0x0500)
 BOOL WINAPI CryptDuplicateHash(HCRYPTHASH,DWORD*,DWORD,HCRYPTHASH*);
 BOOL WINAPI CryptDuplicateKey(HCRYPTKEY,DWORD*,DWORD,HCRYPTKEY*);
@@ -1712,6 +1814,9 @@ BOOL WINAPI CryptSetProviderA(LPCSTR,DWORD);
 BOOL WINAPI CryptSetProviderW(LPCWSTR,DWORD);
 BOOL WINAPI CryptSetProviderExA(LPCSTR,DWORD,DWORD*,DWORD);
 BOOL WINAPI CryptSetProviderExW(LPCWSTR,DWORD,DWORD*,DWORD);
+BOOL WINAPI CryptEncodeObject(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, BYTE *pbEncoded, DWORD *pcbEncoded);
+BOOL WINAPI CryptEncodeObjectEx(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, void *pvEncoded, DWORD *pcbEncoded);
+
 #ifdef UNICODE
 #define CertNameToStr CertNameToStrW
 #define CryptAcquireContext CryptAcquireContextW