summaryrefslogtreecommitdiff
path: root/xmlsecurity
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2021-07-25 21:35:05 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-07-26 14:25:35 +0200
commit6ed8c5a0f19901ab413c6610649326b2475c3a8c (patch)
tree948037d1a61f9e88547b88e107ba6e8a306c3833 /xmlsecurity
parenta23b44fd9f0119f7ea3523e32875f55c1a07c1cd (diff)
use officecfg for security options
Change-Id: I9d91fd5b260b82e05aac6567143386742953ecf6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119486 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmlsecurity')
-rw-r--r--xmlsecurity/inc/macrosecurity.hxx1
-rw-r--r--xmlsecurity/source/component/documentdigitalsignatures.cxx20
-rw-r--r--xmlsecurity/source/dialogs/macrosecurity.cxx24
3 files changed, 19 insertions, 26 deletions
diff --git a/xmlsecurity/inc/macrosecurity.hxx b/xmlsecurity/inc/macrosecurity.hxx
index 690c5b05fcaf..233ef2c1dca1 100644
--- a/xmlsecurity/inc/macrosecurity.hxx
+++ b/xmlsecurity/inc/macrosecurity.hxx
@@ -32,7 +32,6 @@ private:
friend class MacroSecurityTrustedSourcesTP;
css::uno::Reference<css::xml::crypto::XSecurityEnvironment> m_xSecurityEnvironment;
- SvtSecurityOptions m_aSecOptions;
std::unique_ptr<weld::Notebook> m_xTabCtrl;
std::unique_ptr<weld::Button> m_xOkBtn;
diff --git a/xmlsecurity/source/component/documentdigitalsignatures.cxx b/xmlsecurity/source/component/documentdigitalsignatures.cxx
index 5a353c39924b..625bbbd0d4be 100644
--- a/xmlsecurity/source/component/documentdigitalsignatures.cxx
+++ b/xmlsecurity/source/component/documentdigitalsignatures.cxx
@@ -663,7 +663,7 @@ sal_Bool DocumentDigitalSignatures::isAuthorTrusted(
}
OUString sSerialNum = xmlsecurity::bigIntegerToNumericString(xAuthor->getSerialNumber());
- std::vector< SvtSecurityOptions::Certificate > aTrustedAuthors = SvtSecurityOptions().GetTrustedAuthors();
+ std::vector< SvtSecurityOptions::Certificate > aTrustedAuthors = SvtSecurityOptions::GetTrustedAuthors();
return std::any_of(aTrustedAuthors.begin(), aTrustedAuthors.end(),
[&xAuthor, &sSerialNum](const SvtSecurityOptions::Certificate& rAuthor) {
@@ -764,14 +764,12 @@ css::uno::Reference< css::security::XCertificate > DocumentDigitalSignatures::ch
sal_Bool DocumentDigitalSignatures::isLocationTrusted( const OUString& Location )
{
- return SvtSecurityOptions().isTrustedLocationUri(Location);
+ return SvtSecurityOptions::isTrustedLocationUri(Location);
}
void DocumentDigitalSignatures::addAuthorToTrustedSources(
const Reference< css::security::XCertificate >& Author )
{
- SvtSecurityOptions aSecOpts;
-
SvtSecurityOptions::Certificate aNewCert;
aNewCert.SubjectName = Author->getIssuerName();
aNewCert.SerialNumber = xmlsecurity::bigIntegerToNumericString( Author->getSerialNumber() );
@@ -780,21 +778,17 @@ void DocumentDigitalSignatures::addAuthorToTrustedSources(
::comphelper::Base64::encode(aStrBuffer, Author->getEncoded());
aNewCert.RawData = aStrBuffer.makeStringAndClear();
- std::vector< SvtSecurityOptions::Certificate > aTrustedAuthors = aSecOpts.GetTrustedAuthors();
+ std::vector< SvtSecurityOptions::Certificate > aTrustedAuthors = SvtSecurityOptions::GetTrustedAuthors();
aTrustedAuthors.push_back( aNewCert );
- aSecOpts.SetTrustedAuthors( aTrustedAuthors );
+ SvtSecurityOptions::SetTrustedAuthors( aTrustedAuthors );
}
void DocumentDigitalSignatures::addLocationToTrustedSources( const OUString& Location )
{
- SvtSecurityOptions aSecOpt;
-
- Sequence< OUString > aSecURLs = aSecOpt.GetSecureURLs();
- sal_Int32 nCnt = aSecURLs.getLength();
- aSecURLs.realloc( nCnt + 1 );
- aSecURLs[ nCnt ] = Location;
+ std::vector< OUString > aSecURLs = SvtSecurityOptions::GetSecureURLs();
+ aSecURLs.push_back(Location);
- aSecOpt.SetSecureURLs( aSecURLs );
+ SvtSecurityOptions::SetSecureURLs( aSecURLs );
}
sal_Bool DocumentDigitalSignatures::signDocumentWithCertificate(
diff --git a/xmlsecurity/source/dialogs/macrosecurity.cxx b/xmlsecurity/source/dialogs/macrosecurity.cxx
index 2cb08df9cd9f..dbfa41e96d58 100644
--- a/xmlsecurity/source/dialogs/macrosecurity.cxx
+++ b/xmlsecurity/source/dialogs/macrosecurity.cxx
@@ -126,8 +126,8 @@ MacroSecurityLevelTP::MacroSecurityLevelTP(weld::Container* pParent, MacroSecuri
m_xVeryHighRB->set_size_request(nMaxWidth, -1);
}
- mnCurLevel = static_cast<sal_uInt16>(m_pDlg->m_aSecOptions.GetMacroSecurityLevel());
- bool bReadonly = m_pDlg->m_aSecOptions.IsReadOnly( SvtSecurityOptions::EOption::MacroSecLevel );
+ mnCurLevel = static_cast<sal_uInt16>(SvtSecurityOptions::GetMacroSecurityLevel());
+ bool bReadonly = SvtSecurityOptions::IsReadOnly( SvtSecurityOptions::EOption::MacroSecLevel );
weld::RadioButton* pCheck = nullptr;
weld::Widget* pImage = nullptr;
@@ -185,7 +185,7 @@ IMPL_LINK_NOARG(MacroSecurityLevelTP, RadioButtonHdl, weld::Toggleable&, void)
void MacroSecurityLevelTP::ClosePage()
{
- m_pDlg->m_aSecOptions.SetMacroSecurityLevel( mnCurLevel );
+ SvtSecurityOptions::SetMacroSecurityLevel( mnCurLevel );
}
void MacroSecurityTrustedSourcesTP::ImplCheckButtons()
@@ -392,14 +392,14 @@ MacroSecurityTrustedSourcesTP::MacroSecurityTrustedSourcesTP(weld::Container* pP
m_xRemoveLocPB->connect_clicked( LINK( this, MacroSecurityTrustedSourcesTP, RemoveLocPBHdl ) );
m_xRemoveLocPB->set_sensitive(false);
- m_aTrustedAuthors = m_pDlg->m_aSecOptions.GetTrustedAuthors();
- mbAuthorsReadonly = m_pDlg->m_aSecOptions.IsReadOnly( SvtSecurityOptions::EOption::MacroTrustedAuthors );
+ m_aTrustedAuthors = SvtSecurityOptions::GetTrustedAuthors();
+ mbAuthorsReadonly = SvtSecurityOptions::IsReadOnly( SvtSecurityOptions::EOption::MacroTrustedAuthors );
m_xTrustCertROFI->set_visible(mbAuthorsReadonly);
FillCertLB(true);
- const css::uno::Sequence< OUString > aSecureURLs = m_pDlg->m_aSecOptions.GetSecureURLs();
- mbURLsReadonly = m_pDlg->m_aSecOptions.IsReadOnly( SvtSecurityOptions::EOption::SecureUrls );
+ std::vector< OUString > aSecureURLs = SvtSecurityOptions::GetSecureURLs();
+ mbURLsReadonly = SvtSecurityOptions::IsReadOnly( SvtSecurityOptions::EOption::SecureUrls );
m_xTrustFileROFI->set_visible(mbURLsReadonly);
m_xAddLocPB->set_sensitive(!mbURLsReadonly);
@@ -422,22 +422,22 @@ void MacroSecurityTrustedSourcesTP::ClosePage()
sal_Int32 nEntryCnt = m_xTrustFileLocLB->n_children();
if( nEntryCnt )
{
- css::uno::Sequence< OUString > aSecureURLs( nEntryCnt );
+ std::vector< OUString > aSecureURLs;
for (sal_Int32 i = 0; i < nEntryCnt; ++i)
{
OUString aURL(m_xTrustFileLocLB->get_text(i));
osl::FileBase::getFileURLFromSystemPath( aURL, aURL );
- aSecureURLs[ i ] = aURL;
+ aSecureURLs.push_back(aURL);
}
- m_pDlg->m_aSecOptions.SetSecureURLs( aSecureURLs );
+ SvtSecurityOptions::SetSecureURLs( aSecureURLs );
}
// Trusted Path could not be removed (#i33584#)
// don't forget to remove the old saved SecureURLs
else
- m_pDlg->m_aSecOptions.SetSecureURLs( css::uno::Sequence< OUString >() );
+ SvtSecurityOptions::SetSecureURLs( std::vector< OUString >() );
- m_pDlg->m_aSecOptions.SetTrustedAuthors( m_aTrustedAuthors );
+ SvtSecurityOptions::SetTrustedAuthors( m_aTrustedAuthors );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */