1/** 2 * This file has no copyright assigned and is placed in the Public Domain. 3 * This file is part of the mingw-w64 runtime package. 4 * No warranty is given; refer to the file DISCLAIMER.PD within this package. 5 */ 6#ifndef __CRYPTUIAPI_H__ 7#define __CRYPTUIAPI_H__ 8 9#include <_mingw_unicode.h> 10#include <wintrust.h> 11#include <wincrypt.h> 12 13#ifdef __cplusplus 14extern "C" { 15#endif 16 17#include <pshpack8.h> 18 19 WINBOOL WINAPI CryptUIDlgViewContext(DWORD dwContextType,const void *pvContext,HWND hwnd,LPCWSTR pwszTitle,DWORD dwFlags,void *pvReserved); 20 PCCERT_CONTEXT WINAPI CryptUIDlgSelectCertificateFromStore(HCERTSTORE hCertStore,HWND hwnd,LPCWSTR pwszTitle,LPCWSTR pwszDisplayString,DWORD dwDontUseColumn,DWORD dwFlags,void *pvReserved); 21 22#define CRYPTUI_SELECT_ISSUEDTO_COLUMN 0x000000001 23#define CRYPTUI_SELECT_ISSUEDBY_COLUMN 0x000000002 24#define CRYPTUI_SELECT_INTENDEDUSE_COLUMN 0x000000004 25#define CRYPTUI_SELECT_FRIENDLYNAME_COLUMN 0x000000008 26#define CRYPTUI_SELECT_LOCATION_COLUMN 0x000000010 27#define CRYPTUI_SELECT_EXPIRATION_COLUMN 0x000000020 28 29 typedef WINBOOL (WINAPI *PFNCFILTERPROC)(PCCERT_CONTEXT pCertContext,WINBOOL *pfInitialSelectedCert,void *pvCallbackData); 30 31#define CRYPTUI_CERT_MGR_TAB_MASK 0x0000000F 32#define CRYPTUI_CERT_MGR_PUBLISHER_TAB 0x00000004 33#define CRYPTUI_CERT_MGR_SINGLE_TAB_FLAG 0x00008000 34 35 typedef struct _CRYPTUI_CERT_MGR_STRUCT { 36 DWORD dwSize; 37 HWND hwndParent; 38 DWORD dwFlags; 39 LPCWSTR pwszTitle; 40 LPCSTR pszInitUsageOID; 41 } CRYPTUI_CERT_MGR_STRUCT,*PCRYPTUI_CERT_MGR_STRUCT; 42 43 typedef const CRYPTUI_CERT_MGR_STRUCT *PCCRYPTUI_CERT_MGR_STRUCT; 44 45 WINBOOL WINAPI CryptUIDlgCertMgr(PCCRYPTUI_CERT_MGR_STRUCT pCryptUICertMgr); 46 47 typedef struct _CRYPTUI_WIZ_DIGITAL_SIGN_BLOB_INFO { 48 DWORD dwSize; 49 GUID *pGuidSubject; 50 DWORD cbBlob; 51 BYTE *pbBlob; 52 LPCWSTR pwszDisplayName; 53 } CRYPTUI_WIZ_DIGITAL_SIGN_BLOB_INFO,*PCRYPTUI_WIZ_DIGITAL_SIGN_BLOB_INFO; 54 55 typedef const CRYPTUI_WIZ_DIGITAL_SIGN_BLOB_INFO *PCCRYPTUI_WIZ_DIGITAL_SIGN_BLOB_INFO; 56 57 typedef struct _CRYPTUI_WIZ_DIGITAL_SIGN_STORE_INFO { 58 DWORD dwSize; 59 DWORD cCertStore; 60 HCERTSTORE *rghCertStore; 61 PFNCFILTERPROC pFilterCallback; 62 void *pvCallbackData; 63 } CRYPTUI_WIZ_DIGITAL_SIGN_STORE_INFO,*PCRYPTUI_WIZ_DIGITAL_SIGN_STORE_INFO; 64 65 typedef const CRYPTUI_WIZ_DIGITAL_SIGN_STORE_INFO *PCCRYPTUI_WIZ_DIGITAL_SIGN_STORE_INFO; 66 67 typedef struct _CRYPTUI_WIZ_DIGITAL_SIGN_PVK_FILE_INFO { 68 DWORD dwSize; 69 LPWSTR pwszPvkFileName; 70 LPWSTR pwszProvName; 71 DWORD dwProvType; 72 } CRYPTUI_WIZ_DIGITAL_SIGN_PVK_FILE_INFO,*PCRYPTUI_WIZ_DIGITAL_SIGN_PVK_FILE_INFO; 73 74 typedef const CRYPTUI_WIZ_DIGITAL_SIGN_PVK_FILE_INFO *PCCRYPTUI_WIZ_DIGITAL_SIGN_PVK_FILE_INFO; 75 76#define CRYPTUI_WIZ_DIGITAL_SIGN_PVK_FILE 0x01 77#define CRYPTUI_WIZ_DIGITAL_SIGN_PVK_PROV 0x02 78 79 typedef struct _CRYPTUI_WIZ_DIGITAL_SIGN_CERT_PVK_INFO { 80 DWORD dwSize; 81 LPWSTR pwszSigningCertFileName; 82 DWORD dwPvkChoice; 83 __C89_NAMELESS union { 84 PCCRYPTUI_WIZ_DIGITAL_SIGN_PVK_FILE_INFO pPvkFileInfo; 85 PCRYPT_KEY_PROV_INFO pPvkProvInfo; 86 }; 87 } CRYPTUI_WIZ_DIGITAL_SIGN_CERT_PVK_INFO,*PCRYPTUI_WIZ_DIGITAL_SIGN_CERT_PVK_INFO; 88 89 typedef const CRYPTUI_WIZ_DIGITAL_SIGN_CERT_PVK_INFO *PCCRYPTUI_WIZ_DIGITAL_SIGN_CERT_PVK_INFO; 90#define CRYPTUI_WIZ_DIGITAL_SIGN_COMMERCIAL 0x0001 91#define CRYPTUI_WIZ_DIGITAL_SIGN_INDIVIDUAL 0x0002 92 93 typedef struct _CRYPTUI_WIZ_DIGITAL_SIGN_EXTENDED_INFO { 94 DWORD dwSize; 95 DWORD dwAttrFlags; 96 LPCWSTR pwszDescription; 97 LPCWSTR pwszMoreInfoLocation; 98 LPCSTR pszHashAlg; 99 LPCWSTR pwszSigningCertDisplayString; 100 HCERTSTORE hAdditionalCertStore; 101 PCRYPT_ATTRIBUTES psAuthenticated; 102 PCRYPT_ATTRIBUTES psUnauthenticated; 103 } CRYPTUI_WIZ_DIGITAL_SIGN_EXTENDED_INFO,*PCRYPTUI_WIZ_DIGITAL_SIGN_EXTENDED_INFO; 104 105 typedef const CRYPTUI_WIZ_DIGITAL_SIGN_EXTENDED_INFO *PCCRYPTUI_WIZ_DIGITAL_SIGN_EXTENDED_INFO; 106 107#define CRYPTUI_WIZ_DIGITAL_SIGN_SUBJECT_FILE 0x01 108#define CRYPTUI_WIZ_DIGITAL_SIGN_SUBJECT_BLOB 0x02 109#define CRYPTUI_WIZ_DIGITAL_SIGN_CERT 0x01 110#define CRYPTUI_WIZ_DIGITAL_SIGN_STORE 0x02 111#define CRYPTUI_WIZ_DIGITAL_SIGN_PVK 0x03 112 113#define CRYPTUI_WIZ_DIGITAL_SIGN_ADD_CHAIN 0x00000001 114#define CRYPTUI_WIZ_DIGITAL_SIGN_ADD_CHAIN_NO_ROOT 0x00000002 115 116 typedef struct _CRYPTUI_WIZ_DIGITAL_SIGN_INFO { 117 DWORD dwSize; 118 DWORD dwSubjectChoice; 119 __C89_NAMELESS union { 120 LPCWSTR pwszFileName; 121 PCCRYPTUI_WIZ_DIGITAL_SIGN_BLOB_INFO pSignBlobInfo; 122 }; 123 DWORD dwSigningCertChoice; 124 __C89_NAMELESS union { 125 PCCERT_CONTEXT pSigningCertContext; 126 PCCRYPTUI_WIZ_DIGITAL_SIGN_STORE_INFO pSigningCertStore; 127 PCCRYPTUI_WIZ_DIGITAL_SIGN_CERT_PVK_INFO pSigningCertPvkInfo; 128 }; 129 LPCWSTR pwszTimestampURL; 130 DWORD dwAdditionalCertChoice; 131 PCCRYPTUI_WIZ_DIGITAL_SIGN_EXTENDED_INFO pSignExtInfo; 132 } CRYPTUI_WIZ_DIGITAL_SIGN_INFO,*PCRYPTUI_WIZ_DIGITAL_SIGN_INFO; 133 134 typedef const CRYPTUI_WIZ_DIGITAL_SIGN_INFO *PCCRYPTUI_WIZ_DIGITAL_SIGN_INFO; 135 136 typedef struct _CRYPTUI_WIZ_DIGITAL_SIGN_CONTEXT { 137 DWORD dwSize; 138 DWORD cbBlob; 139 BYTE *pbBlob; 140 } CRYPTUI_WIZ_DIGITAL_SIGN_CONTEXT,*PCRYPTUI_WIZ_DIGITAL_SIGN_CONTEXT; 141 142 typedef const CRYPTUI_WIZ_DIGITAL_SIGN_CONTEXT *PCCRYPTUI_WIZ_DIGITAL_SIGN_CONTEXT; 143 144#define CRYPTUI_WIZ_NO_UI 0x0001 145 146 WINBOOL WINAPI CryptUIWizDigitalSign(DWORD dwFlags,HWND hwndParent,LPCWSTR pwszWizardTitle,PCCRYPTUI_WIZ_DIGITAL_SIGN_INFO pDigitalSignInfo,PCCRYPTUI_WIZ_DIGITAL_SIGN_CONTEXT *ppSignContext); 147 WINBOOL WINAPI CryptUIWizFreeDigitalSignContext(PCCRYPTUI_WIZ_DIGITAL_SIGN_CONTEXT pSignContext); 148 149#define CRYPTUI_HIDE_HIERARCHYPAGE 0x00000001 150#define CRYPTUI_HIDE_DETAILPAGE 0x00000002 151#define CRYPTUI_DISABLE_EDITPROPERTIES 0x00000004 152#define CRYPTUI_ENABLE_EDITPROPERTIES 0x00000008 153#define CRYPTUI_DISABLE_ADDTOSTORE 0x00000010 154#define CRYPTUI_ENABLE_ADDTOSTORE 0x00000020 155#define CRYPTUI_ACCEPT_DECLINE_STYLE 0x00000040 156#define CRYPTUI_IGNORE_UNTRUSTED_ROOT 0x00000080 157#define CRYPTUI_DONT_OPEN_STORES 0x00000100 158#define CRYPTUI_ONLY_OPEN_ROOT_STORE 0x00000200 159#define CRYPTUI_WARN_UNTRUSTED_ROOT 0x00000400 160 161#define CRYPTUI_ENABLE_REVOCATION_CHECKING 0x00000800 162 163#define CRYPTUI_WARN_REMOTE_TRUST 0x00001000 164#define CRYPTUI_DISABLE_EXPORT 0x00002000 165 166#define CRYPTUI_ENABLE_REVOCATION_CHECK_END_CERT 0x00004000 167#define CRYPTUI_ENABLE_REVOCATION_CHECK_CHAIN 0x00008000 168#define CRYPTUI_ENABLE_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT CRYPTUI_ENABLE_REVOCATION_CHECKING 169 170 typedef struct tagCRYPTUI_INITDIALOG_STRUCT { 171 LPARAM lParam; 172 PCCERT_CONTEXT pCertContext; 173 } CRYPTUI_INITDIALOG_STRUCT,*PCRYPTUI_INITDIALOG_STRUCT; 174 175 typedef struct tagCRYPTUI_VIEWCERTIFICATE_STRUCTW { 176 DWORD dwSize; 177 HWND hwndParent; 178 DWORD dwFlags; 179 LPCWSTR szTitle; 180 PCCERT_CONTEXT pCertContext; 181 LPCSTR *rgszPurposes; 182 DWORD cPurposes; 183 __C89_NAMELESS union { 184 CRYPT_PROVIDER_DATA const *pCryptProviderData; 185 HANDLE hWVTStateData; 186 }; 187 WINBOOL fpCryptProviderDataTrustedUsage; 188 DWORD idxSigner; 189 DWORD idxCert; 190 WINBOOL fCounterSigner; 191 DWORD idxCounterSigner; 192 DWORD cStores; 193 HCERTSTORE *rghStores; 194 DWORD cPropSheetPages; 195 LPCPROPSHEETPAGEW rgPropSheetPages; 196 DWORD nStartPage; 197 } CRYPTUI_VIEWCERTIFICATE_STRUCTW,*PCRYPTUI_VIEWCERTIFICATE_STRUCTW; 198 199 typedef const CRYPTUI_VIEWCERTIFICATE_STRUCTW *PCCRYPTUI_VIEWCERTIFICATE_STRUCTW; 200 201 typedef struct tagCRYPTUI_VIEWCERTIFICATE_STRUCTA { 202 DWORD dwSize; 203 HWND hwndParent; 204 DWORD dwFlags; 205 LPCSTR szTitle; 206 PCCERT_CONTEXT pCertContext; 207 LPCSTR *rgszPurposes; 208 DWORD cPurposes; 209 __C89_NAMELESS union { 210 CRYPT_PROVIDER_DATA const *pCryptProviderData; 211 HANDLE hWVTStateData; 212 }; 213 WINBOOL fpCryptProviderDataTrustedUsage; 214 DWORD idxSigner; 215 DWORD idxCert; 216 WINBOOL fCounterSigner; 217 DWORD idxCounterSigner; 218 DWORD cStores; 219 HCERTSTORE *rghStores; 220 DWORD cPropSheetPages; 221 LPCPROPSHEETPAGEA rgPropSheetPages; 222 DWORD nStartPage; 223 } CRYPTUI_VIEWCERTIFICATE_STRUCTA,*PCRYPTUI_VIEWCERTIFICATE_STRUCTA; 224 225 typedef const CRYPTUI_VIEWCERTIFICATE_STRUCTA *PCCRYPTUI_VIEWCERTIFICATE_STRUCTA; 226 227 WINBOOL WINAPI CryptUIDlgViewCertificateW(PCCRYPTUI_VIEWCERTIFICATE_STRUCTW pCertViewInfo,WINBOOL *pfPropertiesChanged); 228 WINBOOL WINAPI CryptUIDlgViewCertificateA(PCCRYPTUI_VIEWCERTIFICATE_STRUCTA pCertViewInfo,WINBOOL *pfPropertiesChanged); 229 230#define CryptUIDlgViewCertificate __MINGW_NAME_AW(CryptUIDlgViewCertificate) 231 232#define PCRYPTUI_VIEWCERTIFICATE_STRUCT __MINGW_NAME_AW(PCRYPTUI_VIEWCERTIFICATE_STRUCT) 233#define CRYPTUI_VIEWCERTIFICATE_STRUCT __MINGW_NAME_AW(CRYPTUI_VIEWCERTIFICATE_STRUCT) 234#define PCCRYPTUI_VIEWCERTIFICATE_STRUCT __MINGW_NAME_AW(PCCRYPTUI_VIEWCERTIFICATE_STRUCT) 235 236#define CRYPTUI_WIZ_EXPORT_CERT_CONTEXT 1 237#define CRYPTUI_WIZ_EXPORT_CTL_CONTEXT 2 238#define CRYPTUI_WIZ_EXPORT_CRL_CONTEXT 3 239#define CRYPTUI_WIZ_EXPORT_CERT_STORE 4 240#define CRYPTUI_WIZ_EXPORT_CERT_STORE_CERTIFICATES_ONLY 5 241 242 typedef struct _CRYPTUI_WIZ_EXPORT_INFO { 243 DWORD dwSize; 244 LPCWSTR pwszExportFileName; 245 DWORD dwSubjectChoice; 246 __C89_NAMELESS union { 247 PCCERT_CONTEXT pCertContext; 248 PCCTL_CONTEXT pCTLContext; 249 PCCRL_CONTEXT pCRLContext; 250 HCERTSTORE hCertStore; 251 }; 252 DWORD cStores; 253 HCERTSTORE *rghStores; 254 } CRYPTUI_WIZ_EXPORT_INFO,*PCRYPTUI_WIZ_EXPORT_INFO; 255 256 typedef const CRYPTUI_WIZ_EXPORT_INFO *PCCRYPTUI_WIZ_EXPORT_INFO; 257 258#define CRYPTUI_WIZ_EXPORT_FORMAT_DER 1 259#define CRYPTUI_WIZ_EXPORT_FORMAT_PFX 2 260#define CRYPTUI_WIZ_EXPORT_FORMAT_PKCS7 3 261#define CRYPTUI_WIZ_EXPORT_FORMAT_BASE64 4 262#define CRYPTUI_WIZ_EXPORT_FORMAT_SERIALIZED_CERT_STORE 5 263 264 typedef struct _CRYPTUI_WIZ_EXPORT_CERTCONTEXT_INFO { 265 DWORD dwSize; 266 DWORD dwExportFormat; 267 WINBOOL fExportChain; 268 WINBOOL fExportPrivateKeys; 269 LPCWSTR pwszPassword; 270 WINBOOL fStrongEncryption; 271 } CRYPTUI_WIZ_EXPORT_CERTCONTEXT_INFO,*PCRYPTUI_WIZ_EXPORT_CERTCONTEXT_INFO; 272 273 typedef const CRYPTUI_WIZ_EXPORT_CERTCONTEXT_INFO *PCCRYPTUI_WIZ_EXPORT_CERTCONTEXT_INFO; 274 275 WINBOOL WINAPI CryptUIWizExport(DWORD dwFlags,HWND hwndParent,LPCWSTR pwszWizardTitle,PCCRYPTUI_WIZ_EXPORT_INFO pExportInfo,void *pvoid); 276 277#define CRYPTUI_WIZ_IMPORT_SUBJECT_FILE 1 278#define CRYPTUI_WIZ_IMPORT_SUBJECT_CERT_CONTEXT 2 279#define CRYPTUI_WIZ_IMPORT_SUBJECT_CTL_CONTEXT 3 280#define CRYPTUI_WIZ_IMPORT_SUBJECT_CRL_CONTEXT 4 281#define CRYPTUI_WIZ_IMPORT_SUBJECT_CERT_STORE 5 282 283 typedef struct _CRYPTUI_WIZ_IMPORT_SUBJECT_INFO { 284 DWORD dwSize; 285 DWORD dwSubjectChoice; 286 __C89_NAMELESS union { 287 LPCWSTR pwszFileName; 288 PCCERT_CONTEXT pCertContext; 289 PCCTL_CONTEXT pCTLContext; 290 PCCRL_CONTEXT pCRLContext; 291 HCERTSTORE hCertStore; 292 }; 293 DWORD dwFlags; 294 LPCWSTR pwszPassword; 295 } CRYPTUI_WIZ_IMPORT_SRC_INFO,*PCRYPTUI_WIZ_IMPORT_SRC_INFO; 296 297 typedef const CRYPTUI_WIZ_IMPORT_SRC_INFO *PCCRYPTUI_WIZ_IMPORT_SRC_INFO; 298 299#define CRYPTUI_WIZ_IMPORT_NO_CHANGE_DEST_STORE 0x00010000 300#define CRYPTUI_WIZ_IMPORT_ALLOW_CERT 0x00020000 301#define CRYPTUI_WIZ_IMPORT_ALLOW_CRL 0x00040000 302#define CRYPTUI_WIZ_IMPORT_ALLOW_CTL 0x00080000 303#define CRYPTUI_WIZ_IMPORT_TO_LOCALMACHINE 0x00100000 304#define CRYPTUI_WIZ_IMPORT_TO_CURRENTUSER 0x00200000 305#define CRYPTUI_WIZ_IMPORT_REMOTE_DEST_STORE 0x00400000 306 307 WINBOOL WINAPI CryptUIWizImport(DWORD dwFlags,HWND hwndParent,LPCWSTR pwszWizardTitle,PCCRYPTUI_WIZ_IMPORT_SRC_INFO pImportSrc,HCERTSTORE hDestCertStore); 308 309#include <poppack.h> 310 311#ifdef __cplusplus 312} 313#endif 314#endif 315