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.
This commit is contained in:
Christian Hohnstaedt 2024-09-13 16:04:05 +02:00
parent ec3dec0b44
commit 1ac1dc0a71
2 changed files with 9 additions and 6 deletions

View File

@ -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);

View File

@ -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;