cryptui: Prompt whether to export the private key from CryptUIWizExport.

This commit is contained in:
Juan Lang 2009-02-01 10:28:07 -08:00 committed by Alexandre Julliard
parent 2caf7b8669
commit 53c84a8518
3 changed files with 81 additions and 5 deletions

View file

@ -161,6 +161,8 @@ STRINGTABLE DISCARDABLE
IDS_NO "No"
IDS_EXPORT_SUCCEEDED "The export was successful."
IDS_EXPORT_FAILED "The export failed."
IDS_EXPORT_PRIVATE_KEY_TITLE "Export Private Key"
IDS_EXPORT_PRIVATE_KEY_SUBTITLE "The certificate contains a private key which may be exported along with the certificate."
}
IDD_GENERAL DIALOG DISCARDABLE 0, 0, 255, 236
@ -381,6 +383,18 @@ BEGIN
-1, 115,103,195,8
END
IDD_EXPORT_PRIVATE_KEY DIALOG DISCARDABLE 0,0,317,143
CAPTION "Certificate Export Wizard"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "If you choose to export the private key, you will be prompted for a password to protect the private key on a later page.", -1, 21,1,195,23
LTEXT "Do you wish to export the private key?", -1, 21,24,195,15
AUTORADIOBUTTON "&Yes, export the private key",
IDC_EXPORT_PRIVATE_KEY_YES, 31,36,200,12, BS_AUTORADIOBUTTON|WS_TABSTOP
AUTORADIOBUTTON "N&o, do not export the private key",
IDC_EXPORT_PRIVATE_KEY_NO, 31,48,200,12, BS_AUTORADIOBUTTON
END
IDD_EXPORT_FORMAT DIALOG DISCARDABLE 0,0,317,143
CAPTION "Certificate Export Wizard"
FONT 8, "MS Shell Dlg"

View file

@ -160,6 +160,8 @@
#define IDS_NO 1217
#define IDS_EXPORT_SUCCEEDED 1218
#define IDS_EXPORT_FAILED 1219
#define IDS_EXPORT_PRIVATE_KEY_TITLE 1220
#define IDS_EXPORT_PRIVATE_KEY_SUBTITLE 1221
#define IDD_GENERAL 100
#define IDD_DETAIL 101
@ -175,9 +177,11 @@
#define IDD_CERT_MGR 111
#define IDD_CERT_MGR_ADVANCED 112
#define IDD_EXPORT_WELCOME 113
#define IDD_EXPORT_FORMAT 114
#define IDD_EXPORT_FILE 115
#define IDD_EXPORT_FINISH 116
#define IDD_EXPORT_PRIVATE_KEY 114
#define IDD_EXPORT_PASSWORD 115
#define IDD_EXPORT_FORMAT 116
#define IDD_EXPORT_FILE 117
#define IDD_EXPORT_FINISH 118
#define IDB_SMALL_ICONS 200
#define IDB_CERT 201
@ -253,5 +257,7 @@
#define IDC_EXPORT_FILENAME 2909
#define IDC_EXPORT_BROWSE_FILE 2910
#define IDC_EXPORT_SETTINGS 2911
#define IDC_EXPORT_PRIVATE_KEY_YES 2912
#define IDC_EXPORT_PRIVATE_KEY_NO 2913
#endif /* ndef __CRYPTUIRES_H_ */

View file

@ -5566,6 +5566,42 @@ static LRESULT CALLBACK export_welcome_dlg_proc(HWND hwnd, UINT msg, WPARAM wp,
return ret;
}
static LRESULT CALLBACK export_private_key_dlg_proc(HWND hwnd, UINT msg,
WPARAM wp, LPARAM lp)
{
LRESULT ret = 0;
switch (msg)
{
case WM_INITDIALOG:
{
struct ExportWizData *data;
PROPSHEETPAGEW *page = (PROPSHEETPAGEW *)lp;
data = (struct ExportWizData *)page->lParam;
SetWindowLongPtrW(hwnd, DWLP_USER, (LPARAM)data);
SendMessageW(GetDlgItem(hwnd, IDC_EXPORT_PRIVATE_KEY_NO), BM_CLICK,
0, 0);
break;
}
case WM_NOTIFY:
{
NMHDR *hdr = (NMHDR *)lp;
switch (hdr->code)
{
case PSN_SETACTIVE:
PostMessageW(GetParent(hwnd), PSM_SETWIZBUTTONS, 0,
PSWIZB_BACK | PSWIZB_NEXT);
ret = TRUE;
break;
}
break;
}
}
return ret;
}
static BOOL export_info_has_private_key(PCCRYPTUI_WIZ_EXPORT_INFO pExportInfo)
{
BOOL ret = FALSE;
@ -6370,10 +6406,10 @@ static BOOL show_export_ui(DWORD dwFlags, HWND hwndParent,
LPCWSTR pwszWizardTitle, PCCRYPTUI_WIZ_EXPORT_INFO pExportInfo, void *pvoid)
{
PROPSHEETHEADERW hdr;
PROPSHEETPAGEW pages[4];
PROPSHEETPAGEW pages[6];
struct ExportWizData data;
int nPages = 0;
BOOL showFormatPage = TRUE;
BOOL hasPrivateKey, showFormatPage = TRUE;
data.dwFlags = dwFlags;
data.pwszWizardTitle = pwszWizardTitle;
@ -6402,6 +6438,7 @@ static BOOL show_export_ui(DWORD dwFlags, HWND hwndParent,
pages[nPages].lParam = (LPARAM)&data;
nPages++;
hasPrivateKey = export_info_has_private_key(pExportInfo);
switch (pExportInfo->dwSubjectChoice)
{
case CRYPTUI_WIZ_EXPORT_CRL_CONTEXT:
@ -6419,6 +6456,21 @@ static BOOL show_export_ui(DWORD dwFlags, HWND hwndParent,
data.contextInfo.dwExportFormat = CRYPTUI_WIZ_EXPORT_FORMAT_PKCS7;
break;
}
if (hasPrivateKey && showFormatPage)
{
pages[nPages].dwSize = sizeof(pages[0]);
pages[nPages].hInstance = hInstance;
pages[nPages].u.pszTemplate = MAKEINTRESOURCEW(IDD_EXPORT_PRIVATE_KEY);
pages[nPages].pfnDlgProc = export_private_key_dlg_proc;
pages[nPages].dwFlags = PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
pages[nPages].pszHeaderTitle =
MAKEINTRESOURCEW(IDS_EXPORT_PRIVATE_KEY_TITLE);
pages[nPages].pszHeaderSubTitle =
MAKEINTRESOURCEW(IDS_EXPORT_PRIVATE_KEY_SUBTITLE);
pages[nPages].lParam = (LPARAM)&data;
nPages++;
}
if (showFormatPage)
{
pages[nPages].dwSize = sizeof(pages[0]);
@ -6433,6 +6485,10 @@ static BOOL show_export_ui(DWORD dwFlags, HWND hwndParent,
pages[nPages].lParam = (LPARAM)&data;
nPages++;
}
if (hasPrivateKey && showFormatPage)
{
FIXME("add password page\n");
}
pages[nPages].dwSize = sizeof(pages[0]);
pages[nPages].hInstance = hInstance;