diff options
author | Tor Lillqvist <tml@collabora.com> | 2016-12-21 19:49:10 +0200 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2016-12-21 21:24:09 +0200 |
commit | e1ce7bad62f07faf8f21adac6c3848d142f61953 (patch) | |
tree | 309bd2c4b5a5e03abad2ede2cbfe37910d624bdc /xmlsecurity | |
parent | 0f00751af858da91d379208b8b679002a180ff93 (diff) |
[API CHANGE] createSecurityContext() was always called with an empty string
So drop the parameter then and propagate fallout in the Windows
implementation in xmlsecurity. The NSS implementation already ignored
the parameter completely.
This interface is not 'published' and the parameter was even marked as
'reserved for internal use' so I doubt any external code has used it.
Change-Id: I5915b941b79cfddadc8137c32ed07c20c9ccaa37
Diffstat (limited to 'xmlsecurity')
8 files changed, 14 insertions, 51 deletions
diff --git a/xmlsecurity/qa/certext/SanCertExt.cxx b/xmlsecurity/qa/certext/SanCertExt.cxx index 43254fdd7873..3102ca0ecee0 100644 --- a/xmlsecurity/qa/certext/SanCertExt.cxx +++ b/xmlsecurity/qa/certext/SanCertExt.cxx @@ -126,7 +126,7 @@ namespace { uno::Reference< lang::XMultiServiceFactory > factory(context->getServiceManager(), uno::UNO_QUERY_THROW); uno::Reference< xml::crypto::XSEInitializer > xSEInitializer = xml::crypto::SEInitializer::create(context); uno::Reference< xml::crypto::XXMLSecurityContext > xSecurityContext( - xSEInitializer->createSecurityContext(OUString())); + xSEInitializer->createSecurityContext()); return xSecurityContext->getSecurityEnvironment(); } diff --git a/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx b/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx index 507b3e5ea09e..cbde51748912 100644 --- a/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx +++ b/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx @@ -119,7 +119,7 @@ void PDFSigningTest::setUp() std::vector<SignatureInformation> PDFSigningTest::verify(const OUString& rURL, size_t nCount, const OString& rExpectedSubFilter) { uno::Reference<xml::crypto::XSEInitializer> xSEInitializer = xml::crypto::SEInitializer::create(mxComponentContext); - uno::Reference<xml::crypto::XXMLSecurityContext> xSecurityContext = xSEInitializer->createSecurityContext(OUString()); + uno::Reference<xml::crypto::XXMLSecurityContext> xSecurityContext = xSEInitializer->createSecurityContext(); std::vector<SignatureInformation> aRet; SvFileStream aStream(rURL, StreamMode::READ); @@ -151,7 +151,7 @@ bool PDFSigningTest::sign(const OUString& rInURL, const OUString& rOutURL, size_ { // Make sure that input has nOriginalSignatureCount signatures. uno::Reference<xml::crypto::XSEInitializer> xSEInitializer = xml::crypto::SEInitializer::create(mxComponentContext); - uno::Reference<xml::crypto::XXMLSecurityContext> xSecurityContext = xSEInitializer->createSecurityContext(OUString()); + uno::Reference<xml::crypto::XXMLSecurityContext> xSecurityContext = xSEInitializer->createSecurityContext(); xmlsecurity::pdfio::PDFDocument aDocument; { SvFileStream aStream(rInURL, StreamMode::READ); @@ -223,7 +223,7 @@ void PDFSigningTest::testPDFRemove() { // Make sure that good.pdf has 1 valid signature. uno::Reference<xml::crypto::XSEInitializer> xSEInitializer = xml::crypto::SEInitializer::create(mxComponentContext); - uno::Reference<xml::crypto::XXMLSecurityContext> xSecurityContext = xSEInitializer->createSecurityContext(OUString()); + uno::Reference<xml::crypto::XXMLSecurityContext> xSecurityContext = xSEInitializer->createSecurityContext(); xmlsecurity::pdfio::PDFDocument aDocument; { OUString aSourceDir = m_directories.getURLFromSrc(DATA_DIRECTORY); @@ -257,7 +257,7 @@ void PDFSigningTest::testPDFRemoveAll() // testPDFRemove(), here intentionally test DocumentSignatureManager and // PDFSignatureHelper code as well. uno::Reference<xml::crypto::XSEInitializer> xSEInitializer = xml::crypto::SEInitializer::create(mxComponentContext); - uno::Reference<xml::crypto::XXMLSecurityContext> xSecurityContext = xSEInitializer->createSecurityContext(OUString()); + uno::Reference<xml::crypto::XXMLSecurityContext> xSecurityContext = xSEInitializer->createSecurityContext(); // Copy the test document to a temporary file, as it'll be modified. OUString aTargetDir = m_directories.getURLFromWorkdir("/CppunitTest/xmlsecurity_pdfsigning.test.user/"); @@ -410,7 +410,7 @@ void PDFSigningTest::testUnknownSubFilter() { // Tokenize the bugdoc. uno::Reference<xml::crypto::XSEInitializer> xSEInitializer = xml::crypto::SEInitializer::create(mxComponentContext); - uno::Reference<xml::crypto::XXMLSecurityContext> xSecurityContext = xSEInitializer->createSecurityContext(OUString()); + uno::Reference<xml::crypto::XXMLSecurityContext> xSecurityContext = xSEInitializer->createSecurityContext(); SvStream* pStream = utl::UcbStreamHelper::CreateStream(m_directories.getURLFromSrc(DATA_DIRECTORY) + "cr-comment.pdf", StreamMode::READ | StreamMode::WRITE); uno::Reference<io::XStream> xStream(new utl::OStreamWrapper(*pStream)); DocumentSignatureManager aManager(mxComponentContext, DocumentSignatureMode::Content); diff --git a/xmlsecurity/source/helper/documentsignaturemanager.cxx b/xmlsecurity/source/helper/documentsignaturemanager.cxx index 76e0b0aefaa9..df753def1118 100644 --- a/xmlsecurity/source/helper/documentsignaturemanager.cxx +++ b/xmlsecurity/source/helper/documentsignaturemanager.cxx @@ -56,7 +56,7 @@ bool DocumentSignatureManager::init() mxSEInitializer = css::xml::crypto::SEInitializer::create(mxContext); if (mxSEInitializer.is()) - mxSecurityContext = mxSEInitializer->createSecurityContext(OUString()); + mxSecurityContext = mxSEInitializer->createSecurityContext(); return mxSecurityContext.is(); } diff --git a/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx index 91158dd14d6b..a933ba9691b2 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx +++ b/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx @@ -45,31 +45,12 @@ SEInitializer_MSCryptImpl::~SEInitializer_MSCryptImpl() /* XSEInitializer */ cssu::Reference< cssxc::XXMLSecurityContext > SAL_CALL - SEInitializer_MSCryptImpl::createSecurityContext( - const OUString& sCertDB ) + SEInitializer_MSCryptImpl::createSecurityContext() throw (cssu::RuntimeException) { - const char* n_pCertStore ; - HCERTSTORE n_hStoreHandle ; - //Initialize the crypto engine - if( sCertDB.getLength() > 0 ) - { - OString sCertDir(sCertDB.getStr(), sCertDB.getLength(), RTL_TEXTENCODING_ASCII_US); - n_pCertStore = sCertDir.getStr(); - n_hStoreHandle = CertOpenSystemStore( NULL, n_pCertStore ) ; - if( n_hStoreHandle == nullptr ) - { - return nullptr; - } - } - else - { - n_pCertStore = nullptr ; - n_hStoreHandle = nullptr ; - } - xmlSecMSCryptoAppInit( n_pCertStore ) ; + xmlSecMSCryptoAppInit( nullptr ) ; try { /* Build Security Environment */ @@ -80,24 +61,11 @@ cssu::Reference< cssxc::XXMLSecurityContext > SAL_CALL SecurityEnvironment_MSCryptImpl* pSecEnv = reinterpret_cast<SecurityEnvironment_MSCryptImpl*>(xSecEnvTunnel->getSomething( SecurityEnvironment_MSCryptImpl::getUnoTunnelId() )); if( pSecEnv == nullptr ) { - if( n_hStoreHandle != nullptr ) - { - CertCloseStore( n_hStoreHandle, CERT_CLOSE_STORE_FORCE_FLAG ) ; - } - xmlSecMSCryptoAppShutdown() ; return nullptr; } - if( n_hStoreHandle != nullptr ) - { - pSecEnv->setCryptoSlot( n_hStoreHandle ) ; - pSecEnv->setCertDb( n_hStoreHandle ) ; - } - else - { - pSecEnv->enableDefaultCrypt( true ) ; - } + pSecEnv->enableDefaultCrypt( true ) ; /* Build XML Security Context */ cssu::Reference< cssxc::XXMLSecurityContext > xSecCtx = cssxc::XMLSecurityContext::create( mxContext ); @@ -107,11 +75,6 @@ cssu::Reference< cssxc::XXMLSecurityContext > SAL_CALL } catch( cssu::Exception& ) { - if( n_hStoreHandle != nullptr ) - { - CertCloseStore( n_hStoreHandle, CERT_CLOSE_STORE_FORCE_FLAG ) ; - } - xmlSecMSCryptoAppShutdown() ; return nullptr; } diff --git a/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.hxx b/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.hxx index 46c698c4e455..ac11d9fa1957 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.hxx +++ b/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.hxx @@ -56,7 +56,7 @@ public: /* XSEInitializer */ virtual css::uno::Reference< css::xml::crypto::XXMLSecurityContext > - SAL_CALL createSecurityContext( const OUString& certDB ) + SAL_CALL createSecurityContext() throw (css::uno::RuntimeException) override; virtual void SAL_CALL freeSecurityContext( const css::uno::Reference< diff --git a/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx index 012106c41c05..0273a28ea06e 100644 --- a/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx @@ -63,7 +63,7 @@ SEInitializer_NssImpl::~SEInitializer_NssImpl() /* XSEInitializer */ uno::Reference< cssxc::XXMLSecurityContext > SAL_CALL - SEInitializer_NssImpl::createSecurityContext( const OUString& ) + SEInitializer_NssImpl::createSecurityContext() throw (uno::RuntimeException, std::exception) { CERTCertDBHandle *pCertHandle = nullptr ; diff --git a/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.hxx b/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.hxx index 685473283195..e223134909cd 100644 --- a/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.hxx +++ b/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.hxx @@ -41,7 +41,7 @@ public: /* XSEInitializer */ virtual css::uno::Reference< css::xml::crypto::XXMLSecurityContext > - SAL_CALL createSecurityContext( const OUString& ) + SAL_CALL createSecurityContext() throw (css::uno::RuntimeException, std::exception) override; virtual void SAL_CALL freeSecurityContext( const css::uno::Reference< diff --git a/xmlsecurity/workben/pdfverify.cxx b/xmlsecurity/workben/pdfverify.cxx index 92504fcba42d..fea369d74e4d 100644 --- a/xmlsecurity/workben/pdfverify.cxx +++ b/xmlsecurity/workben/pdfverify.cxx @@ -56,7 +56,7 @@ int pdfVerify(int nArgc, char** pArgv) SAL_WARN("xmlsecurity.pdfio", "DeploymentException while creating SEInitializer: " << rException.Message); return 1; } - uno::Reference<xml::crypto::XXMLSecurityContext> xSecurityContext = xSEInitializer->createSecurityContext(OUString()); + uno::Reference<xml::crypto::XXMLSecurityContext> xSecurityContext = xSEInitializer->createSecurityContext(); OUString aInURL; osl::FileBase::getFileURLFromSystemPath(OUString::fromUtf8(pArgv[1]), aInURL); |