diff options
Diffstat (limited to 'xmlsecurity')
4 files changed, 7 insertions, 35 deletions
diff --git a/xmlsecurity/inc/xmlsecurity/certificatechooser.hxx b/xmlsecurity/inc/xmlsecurity/certificatechooser.hxx index 24b86372a9fa..f37638066cd0 100644 --- a/xmlsecurity/inc/xmlsecurity/certificatechooser.hxx +++ b/xmlsecurity/inc/xmlsecurity/certificatechooser.hxx @@ -46,7 +46,6 @@ private: css::uno::Reference< css::uno::XComponentContext > mxCtx; css::uno::Reference< css::xml::crypto::XSecurityEnvironment > mxSecurityEnvironment; css::uno::Sequence< css::uno::Reference< css::security::XCertificate > > maCerts; - SignatureInformations maCertsToIgnore; VclPtr<SvSimpleTable> m_pCertLB; VclPtr<PushButton> m_pViewBtn; @@ -65,7 +64,7 @@ private: void ImplInitialize(); public: - CertificateChooser( vcl::Window* pParent, css::uno::Reference< css::uno::XComponentContext>& rxCtx, css::uno::Reference< css::xml::crypto::XSecurityEnvironment >& rxSecurityEnvironment, const SignatureInformations& rCertsToIgnore ); + CertificateChooser(vcl::Window* pParent, css::uno::Reference< css::uno::XComponentContext>& rxCtx, css::uno::Reference< css::xml::crypto::XSecurityEnvironment >& rxSecurityEnvironment); virtual ~CertificateChooser(); virtual void dispose() override; diff --git a/xmlsecurity/source/component/documentdigitalsignatures.cxx b/xmlsecurity/source/component/documentdigitalsignatures.cxx index 3ee458fc9f66..f020df44b537 100644 --- a/xmlsecurity/source/component/documentdigitalsignatures.cxx +++ b/xmlsecurity/source/component/documentdigitalsignatures.cxx @@ -439,7 +439,7 @@ Reference< css::security::XCertificate > DocumentDigitalSignatures::chooseCertif if ( aSignatureHelper.Init() ) xSecEnv = aSignatureHelper.GetSecurityEnvironment(); - ScopedVclPtrInstance< CertificateChooser > aChooser( nullptr, mxCtx, xSecEnv, aSignatureHelper.GetSignatureInformations()); + ScopedVclPtrInstance< CertificateChooser > aChooser(nullptr, mxCtx, xSecEnv); if (aChooser->Execute() != RET_OK) return Reference< css::security::XCertificate >(nullptr); diff --git a/xmlsecurity/source/dialogs/certificatechooser.cxx b/xmlsecurity/source/dialogs/certificatechooser.cxx index fcffef660cb0..99fb5a1f406d 100644 --- a/xmlsecurity/source/dialogs/certificatechooser.cxx +++ b/xmlsecurity/source/dialogs/certificatechooser.cxx @@ -48,9 +48,8 @@ sal_uInt16 CertificateChooser::GetSelectedEntryPos() const return (sal_uInt16) nSel; } -CertificateChooser::CertificateChooser( vcl::Window* _pParent, uno::Reference< uno::XComponentContext>& _rxCtx, uno::Reference< css::xml::crypto::XSecurityEnvironment >& _rxSecurityEnvironment, const SignatureInformations& _rCertsToIgnore ) +CertificateChooser::CertificateChooser(vcl::Window* _pParent, uno::Reference<uno::XComponentContext>& _rxCtx, uno::Reference<xml::crypto::XSecurityEnvironment>& _rxSecurityEnvironment) : ModalDialog(_pParent, "SelectCertificateDialog", "xmlsec/ui/selectcertificatedialog.ui") - , maCertsToIgnore( _rCertsToIgnore ) { get(m_pOKBtn, "ok"); get(m_pViewBtn, "viewcert"); @@ -136,39 +135,13 @@ void CertificateChooser::ImplInitialize() ::com::sun::star::security::SerialNumberAdapter::create(mxCtx); sal_Int32 nCertificates = maCerts.getLength(); - sal_Int32 nCertificatesToIgnore = maCertsToIgnore.size(); for( sal_Int32 nCert = nCertificates; nCert; ) { uno::Reference< security::XCertificate > xCert = maCerts[ --nCert ]; - bool bIgnoreThis = false; + // Check if we have a private key for this... + long nCertificateCharacters = mxSecurityEnvironment->getCertificateCharacters(xCert); - // Do we already use that? - if( nCertificatesToIgnore ) - { - OUString aIssuerName = xCert->getIssuerName(); - for( sal_Int32 nSig = 0; nSig < nCertificatesToIgnore; ++nSig ) - { - const SignatureInformation& rInf = maCertsToIgnore[ nSig ]; - if ( ( aIssuerName == rInf.ouX509IssuerName ) && - ( xSerialNumberAdapter->toString( xCert->getSerialNumber() ) == rInf.ouX509SerialNumber ) ) - { - bIgnoreThis = true; - break; - } - } - } - - if ( !bIgnoreThis ) - { - // Check if we have a private key for this... - long nCertificateCharacters = mxSecurityEnvironment->getCertificateCharacters( xCert ); - - if ( !( nCertificateCharacters & security::CertificateCharacters::HAS_PRIVATE_KEY ) ) - bIgnoreThis = true; - - } - - if ( bIgnoreThis ) + if (!(nCertificateCharacters & security::CertificateCharacters::HAS_PRIVATE_KEY)) { ::comphelper::removeElementAt( maCerts, nCert ); nCertificates = maCerts.getLength(); diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx index 70d1d9b5d9a6..590a8a90427e 100644 --- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx +++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx @@ -430,7 +430,7 @@ IMPL_LINK_NOARG_TYPED(DigitalSignaturesDialog, AddButtonHdl, Button*, void) uno::Reference<com::sun::star::security::XSerialNumberAdapter> xSerialNumberAdapter = ::com::sun::star::security::SerialNumberAdapter::create(mxCtx); - ScopedVclPtrInstance< CertificateChooser > aChooser( this, mxCtx, xSecEnv, maCurrentSignatureInformations ); + ScopedVclPtrInstance< CertificateChooser > aChooser( this, mxCtx, xSecEnv ); if ( aChooser->Execute() == RET_OK ) { uno::Reference< ::com::sun::star::security::XCertificate > xCert = aChooser->GetSelectedCertificate(); |