From 1ac1dc0a7134f925e8dfd5b15d0496fd4699a08f Mon Sep 17 00:00:00 2001 From: Christian Hohnstaedt Date: Fri, 13 Sep 2024 16:04:05 +0200 Subject: [PATCH] Extend password write dialogs by the file name Now the Password dialog for exported items also shows the file name of the current export and not only the internal name of the item. --- lib/pki_evp.cpp | 8 ++++---- lib/pki_pkcs12.cpp | 7 +++++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/pki_evp.cpp b/lib/pki_evp.cpp index 570f3e4d..5eed8b49 100644 --- a/lib/pki_evp.cpp +++ b/lib/pki_evp.cpp @@ -846,8 +846,8 @@ void pki_evp::writePKCS8(XFile &file, const EVP_CIPHER *enc, pem_password_cb *cb, bool pem) const { pass_info p(XCA_TITLE, - tr("Please enter the password protecting the PKCS#8 key '%1'") - .arg(getIntName())); + tr("Please enter the password to protect the PKCS#8 key '%1' in file:\n%2") + .arg(getIntName()).arg(nativeSeparator(file.fileName()))); EVP_PKEY *pkey = decryptKey(); if (!pkey) { pki_openssl_error(); @@ -903,8 +903,8 @@ void pki_evp::writeKey(XFile &file, const EVP_CIPHER *enc, pem_password_cb *cb, bool pem) const { pass_info p(XCA_TITLE, - tr("Please enter the export password for the private key '%1'") - .arg(getIntName())); + tr("Please enter the password to protect the private key '%1' in file:\n%2") + .arg(getIntName()).arg(nativeSeparator(file.fileName()))); if (isPubKey()) { writePublic(file, pem); diff --git a/lib/pki_pkcs12.cpp b/lib/pki_pkcs12.cpp index 8539121f..7706578f 100644 --- a/lib/pki_pkcs12.cpp +++ b/lib/pki_pkcs12.cpp @@ -133,12 +133,15 @@ void pki_pkcs12::writePKCS12(XFile &file, encAlgo &encAlgo) const { Passwd pass; PKCS12 *pkcs12; - pass_info p(XCA_TITLE, - tr("Please enter the password to encrypt the PKCS#12 file")); if (cert == NULL || key == NULL) my_error(tr("No key or no Cert and no pkcs12")); + pass_info p(XCA_TITLE, + tr("Please enter the password to encrypt the key of certificate '%1' " + "in the PKCS#12 file:\n%2") + .arg(cert->getIntName()).arg(nativeSeparator(file.fileName()))); + if (PwDialogCore::execute(&p, &pass, true) != 1) return;