xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
New commits:
commit 684b7b5a8bc9a0632e0cb87c18133814acc20188
Author:     Moritz Duge <moritz.d...@allotropia.de>
AuthorDate: Tue Aug 6 17:38:25 2024 +0200
Commit:     Thorsten Behrens <thorsten.behr...@allotropia.de>
CommitDate: Tue Aug 13 01:09:28 2024 +0200

    tdf#161909: show NSS cert DB path (MOZ profile) in password dialog
    
    When selecting a X.509 cert on Unix/Linux/macOS. (ODF+PDF signing)
    
    Helps the user to know which password is requested.
    Previously only asked for the "NSS Certificate DB" password.
    
    Change-Id: Ic44d3c4b2f98185c07b11f9880d64016aa0b60ca
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171641
    Tested-by: Jenkins
    Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de>

diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx 
b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
index bbdef624742f..f50bd6517a37 100644
--- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
@@ -52,6 +52,7 @@
 #include <com/sun/star/security/NoPasswordException.hpp>
 #include <com/sun/star/security/CertificateCharacters.hpp>
 #include <com/sun/star/security/CertificateValidity.hpp>
+#include <com/sun/star/xml/crypto/NSSInitializer.hpp>
 
 namespace csss = ::com::sun::star::security;
 using namespace ::com::sun::star::security;
@@ -99,8 +100,12 @@ static char* GetPasswordFunction( PK11SlotInfo* pSlot, 
PRBool bRetry, void* /*ar
         task::InteractionHandler::createWithParent(xContext, nullptr) );
 
     task::PasswordRequestMode eMode = bRetry ? 
task::PasswordRequestMode_PASSWORD_REENTER : 
task::PasswordRequestMode_PASSWORD_ENTER;
+    OUString passwordLabel = 
xml::crypto::NSSInitializer::create(xContext)->getNSSPath();
+    if (!passwordLabel.isEmpty())
+        passwordLabel = ": " + passwordLabel;
+    passwordLabel = OUString::createFromAscii(PK11_GetTokenName(pSlot)) + 
passwordLabel;
     rtl::Reference<::comphelper::DocPasswordRequest> pPasswordRequest = new 
::comphelper::DocPasswordRequest(
-        ::comphelper::DocPasswordRequestType::Standard, eMode, 
OUString::createFromAscii(PK11_GetTokenName(pSlot)) );
+        ::comphelper::DocPasswordRequestType::Standard, eMode, passwordLabel);
 
     xInteractionHandler->handle( pPasswordRequest );
 

Reply via email to