cryptui: Disable the PFX export format in the export wizard unless the source has a private key.

This commit is contained in:
Juan Lang 2009-01-23 09:04:14 -08:00 committed by Alexandre Julliard
parent 245e22fb94
commit 7f9c8fa92f
2 changed files with 14 additions and 1 deletions

View File

@ -380,7 +380,7 @@ BEGIN
CHECKBOX "&Include all certificates in the certification path if possible",
IDC_EXPORT_CMS_INCLUDE_CHAIN, 44,57,200,8, BS_AUTOCHECKBOX|WS_TABSTOP|WS_DISABLED
AUTORADIOBUTTON "&Personal Information Exchange/PKCS #12 (.pfx)",
IDC_EXPORT_FORMAT_PFX, 31,72,200,12, BS_AUTORADIOBUTTON
IDC_EXPORT_FORMAT_PFX, 31,72,200,12, BS_AUTORADIOBUTTON|WS_DISABLED
CHECKBOX "Incl&ude all certificates in the certification path if possible",
IDC_EXPORT_PFX_INCLUDE_CHAIN, 44,87,200,8, BS_AUTOCHECKBOX|WS_TABSTOP|WS_DISABLED
CHECKBOX "&Enable strong encryption",

View File

@ -5567,6 +5567,19 @@ static LRESULT CALLBACK export_file_dlg_proc(HWND hwnd, UINT msg, WPARAM wp,
data = (struct ExportWizData *)page->lParam;
SetWindowLongPtrW(hwnd, DWLP_USER, (LPARAM)data);
if (data->pExportInfo->dwSubjectChoice ==
CRYPTUI_WIZ_EXPORT_CERT_CONTEXT)
{
DWORD size;
/* If there's a CRYPT_KEY_PROV_INFO set for this cert, assume the
* cert has a private key.
*/
if (CertGetCertificateContextProperty(
data->pExportInfo->u.pCertContext, CERT_KEY_PROV_INFO_PROP_ID,
NULL, &size))
EnableWindow(GetDlgItem(hwnd, IDC_EXPORT_FORMAT_PFX), TRUE);
}
break;
}
case WM_NOTIFY: