cryptui: Add support for exporting a serialized store from CryptUIWizExport.
This commit is contained in:
parent
072b606588
commit
a7096f9636
|
@ -153,6 +153,7 @@ STRINGTABLE DISCARDABLE
|
|||
IDS_EXPORT_FILTER_CTL "Certificate Trust List (*.stl)"
|
||||
IDS_EXPORT_FILTER_CMS "CMS/PKCS #7 Messages (*.p7b)"
|
||||
IDS_EXPORT_FILTER_PFX "Personal Information Exchange (*.pfx)"
|
||||
IDS_EXPORT_FILTER_SERIALIZED_CERT_STORE "Serialized Certificate Store (*.sst)"
|
||||
IDS_EXPORT_FORMAT "File Format"
|
||||
IDS_EXPORT_INCLUDE_CHAIN "Include all certificates in certificate path"
|
||||
IDS_EXPORT_KEYS "Export keys"
|
||||
|
|
|
@ -152,13 +152,14 @@
|
|||
#define IDS_EXPORT_FILTER_CTL 1209
|
||||
#define IDS_EXPORT_FILTER_CMS 1210
|
||||
#define IDS_EXPORT_FILTER_PFX 1211
|
||||
#define IDS_EXPORT_FORMAT 1212
|
||||
#define IDS_EXPORT_INCLUDE_CHAIN 1213
|
||||
#define IDS_EXPORT_KEYS 1214
|
||||
#define IDS_YES 1215
|
||||
#define IDS_NO 1216
|
||||
#define IDS_EXPORT_SUCCEEDED 1217
|
||||
#define IDS_EXPORT_FAILED 1218
|
||||
#define IDS_EXPORT_FILTER_SERIALIZED_CERT_STORE 1212
|
||||
#define IDS_EXPORT_FORMAT 1213
|
||||
#define IDS_EXPORT_INCLUDE_CHAIN 1214
|
||||
#define IDS_EXPORT_KEYS 1215
|
||||
#define IDS_YES 1216
|
||||
#define IDS_NO 1217
|
||||
#define IDS_EXPORT_SUCCEEDED 1218
|
||||
#define IDS_EXPORT_FAILED 1219
|
||||
|
||||
#define IDD_GENERAL 100
|
||||
#define IDD_DETAIL 101
|
||||
|
|
|
@ -5633,6 +5633,7 @@ static LPWSTR export_append_extension(struct ExportWizData *data,
|
|||
static const WCHAR ctl[] = { '.','c','t','l',0 };
|
||||
static const WCHAR p7b[] = { '.','p','7','b',0 };
|
||||
static const WCHAR pfx[] = { '.','p','f','x',0 };
|
||||
static const WCHAR sst[] = { '.','s','s','t',0 };
|
||||
LPCWSTR extension;
|
||||
LPWSTR dot;
|
||||
BOOL appendExtension;
|
||||
|
@ -5654,6 +5655,9 @@ static LPWSTR export_append_extension(struct ExportWizData *data,
|
|||
case CRYPTUI_WIZ_EXPORT_CTL_CONTEXT:
|
||||
extension = ctl;
|
||||
break;
|
||||
case CRYPTUI_WIZ_EXPORT_CERT_STORE:
|
||||
extension = sst;
|
||||
break;
|
||||
default:
|
||||
extension = cer;
|
||||
}
|
||||
|
@ -5760,6 +5764,7 @@ static const WCHAR export_filter_crl[] = { '*','.','c','r','l',0 };
|
|||
static const WCHAR export_filter_ctl[] = { '*','.','s','t','l',0 };
|
||||
static const WCHAR export_filter_cms[] = { '*','.','p','7','b',0 };
|
||||
static const WCHAR export_filter_pfx[] = { '*','.','p','f','x',0 };
|
||||
static const WCHAR export_filter_sst[] = { '*','.','s','s','t',0 };
|
||||
|
||||
static WCHAR *make_export_file_filter(DWORD exportFormat, DWORD subjectChoice)
|
||||
{
|
||||
|
@ -5792,6 +5797,10 @@ static WCHAR *make_export_file_filter(DWORD exportFormat, DWORD subjectChoice)
|
|||
baseID = IDS_EXPORT_FILTER_CTL;
|
||||
filterStr = export_filter_ctl;
|
||||
break;
|
||||
case CRYPTUI_WIZ_EXPORT_CERT_STORE:
|
||||
baseID = IDS_EXPORT_FILTER_SERIALIZED_CERT_STORE;
|
||||
filterStr = export_filter_sst;
|
||||
break;
|
||||
default:
|
||||
baseID = IDS_EXPORT_FILTER_CERT;
|
||||
filterStr = export_filter_cert;
|
||||
|
@ -5968,6 +5977,7 @@ static void show_export_details(HWND lv, struct ExportWizData *data)
|
|||
{
|
||||
case CRYPTUI_WIZ_EXPORT_CRL_CONTEXT:
|
||||
case CRYPTUI_WIZ_EXPORT_CTL_CONTEXT:
|
||||
case CRYPTUI_WIZ_EXPORT_CERT_STORE:
|
||||
/* do nothing */
|
||||
break;
|
||||
default:
|
||||
|
@ -6011,6 +6021,9 @@ static void show_export_details(HWND lv, struct ExportWizData *data)
|
|||
case CRYPTUI_WIZ_EXPORT_CTL_CONTEXT:
|
||||
contentID = IDS_EXPORT_FILTER_CTL;
|
||||
break;
|
||||
case CRYPTUI_WIZ_EXPORT_CERT_STORE:
|
||||
contentID = IDS_EXPORT_FILTER_SERIALIZED_CERT_STORE;
|
||||
break;
|
||||
default:
|
||||
switch (data->contextInfo.dwExportFormat)
|
||||
{
|
||||
|
@ -6132,6 +6145,12 @@ static BOOL save_cms(HANDLE file, PCCRYPTUI_WIZ_EXPORT_INFO pExportInfo,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static BOOL save_serialized_store(HANDLE file, HCERTSTORE store)
|
||||
{
|
||||
return CertSaveStore(store, PKCS_7_ASN_ENCODING | X509_ASN_ENCODING,
|
||||
CERT_STORE_SAVE_AS_STORE, CERT_STORE_SAVE_TO_FILE, file, 0);
|
||||
}
|
||||
|
||||
static BOOL do_export(HANDLE file, PCCRYPTUI_WIZ_EXPORT_INFO pExportInfo,
|
||||
PCCRYPTUI_WIZ_EXPORT_CERTCONTEXT_INFO pContextInfo)
|
||||
{
|
||||
|
@ -6154,6 +6173,9 @@ static BOOL do_export(HANDLE file, PCCRYPTUI_WIZ_EXPORT_INFO pExportInfo,
|
|||
pExportInfo->u.pCTLContext->pbCtlEncoded,
|
||||
pExportInfo->u.pCTLContext->cbCtlEncoded);
|
||||
break;
|
||||
case CRYPTUI_WIZ_EXPORT_CERT_STORE:
|
||||
ret = save_serialized_store(file, pExportInfo->u.hCertStore);
|
||||
break;
|
||||
default:
|
||||
switch (pContextInfo->dwExportFormat)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue