LibreOffice Module xmlsecurity (master) 1
nssinitializer.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <com/sun/star/lang/IllegalArgumentException.hpp>
21#include <com/sun/star/mozilla/XMozillaBootstrap.hpp>
22#include <com/sun/star/xml/crypto/DigestID.hpp>
23#include <com/sun/star/xml/crypto/CipherID.hpp>
24#include <com/sun/star/xml/crypto/NSSInitializer.hpp>
25#include <com/sun/star/uno/XComponentContext.hpp>
27#include <officecfg/Office/Common.hxx>
28#include <sal/types.h>
29#include <rtl/bootstrap.hxx>
30#include <rtl/string.hxx>
31#include <osl/file.hxx>
32#include <osl/thread.h>
33#include <sal/log.hxx>
35#include <unotools/tempfile.hxx>
38
40
41#include "digestcontext.hxx"
42#include "ciphercontext.hxx"
43
44#include <cstddef>
45#include <memory>
46#include <utility>
47#include <vector>
48
49#include <nss.h>
50#include <pk11pub.h>
51#include <secmod.h>
52#include <prerror.h>
53#include <prinit.h>
54
55namespace cssu = css::uno;
56namespace cssl = css::lang;
57
58using namespace com::sun::star;
59
60#define ROOT_CERTS "Root Certs for OpenOffice.org"
61
62extern "C" {
63
64static void nsscrypto_finalize();
65
66}
67
68namespace
69{
70
71class InitNSSPrivate
72{
73private:
74 std::optional<utl::TempFileNamed> m_oTempFileDatabaseDirectory;
75
76public:
77 OUString getTempDatabasePath()
78 {
79 if (!m_oTempFileDatabaseDirectory)
80 {
81 m_oTempFileDatabaseDirectory.emplace(nullptr, true);
82 m_oTempFileDatabaseDirectory->EnableKillingFile();
83 }
84 return m_oTempFileDatabaseDirectory->GetFileName();
85 }
86
87 void reset()
88 {
89 if (m_oTempFileDatabaseDirectory)
90 {
91 m_oTempFileDatabaseDirectory.reset();
92 }
93 }
94};
95
97{
98 static comphelper::SingletonRef<InitNSSPrivate> aInitNSSPrivate;
99 return &aInitNSSPrivate;
100}
101
102bool nsscrypto_initialize( const css::uno::Reference< css::uno::XComponentContext > &rxContext, bool & out_nss_init );
103
104#ifdef XMLSEC_CRYPTO_NSS
105
106void deleteRootsModule()
107{
108 SECMODModule *RootsModule = nullptr;
109 SECMODModuleList *list = SECMOD_GetDefaultModuleList();
110 SECMODListLock *lock = SECMOD_GetDefaultModuleListLock();
111 SECMOD_GetReadLock(lock);
112
113 while (!RootsModule && list)
114 {
115 SECMODModule *module = list->module;
116
117 for (int i=0; i < module->slotCount; i++)
118 {
119 PK11SlotInfo *slot = module->slots[i];
120 if (PK11_IsPresent(slot))
121 {
122 if (PK11_HasRootCerts(slot))
123 {
124 SAL_INFO("xmlsecurity.xmlsec", "The root certificates module \"" << module->commonName << "\" is already loaded: " << module->dllName);
125
126 RootsModule = SECMOD_ReferenceModule(module);
127 break;
128 }
129 }
130 }
131 list = list->next;
132 }
133 SECMOD_ReleaseReadLock(lock);
134
135 if (!RootsModule)
136 return;
137
138 PRInt32 modType;
139 if (SECSuccess == SECMOD_DeleteModule(RootsModule->commonName, &modType))
140 {
141 SAL_INFO("xmlsecurity.xmlsec", "Deleted module \"" << RootsModule->commonName << "\".");
142 }
143 else
144 {
145 SAL_INFO("xmlsecurity.xmlsec", "Failed to delete \"" << RootsModule->commonName << "\": " << RootsModule->dllName);
146 }
147 SECMOD_DestroyModule(RootsModule);
148 RootsModule = nullptr;
149}
150
151#endif
152
153bool lcl_pathExists(const OUString& sPath)
154{
155 if (sPath.isEmpty())
156 return false;
157
158 ::osl::DirectoryItem aPathItem;
159 OUString sURL;
160 osl::FileBase::getFileURLFromSystemPath(sPath, sURL);
161 if (::osl::FileBase::E_None == ::osl::DirectoryItem::get(sURL, aPathItem))
162 {
163 ::osl::FileStatus aStatus = osl_FileStatus_Mask_Validate;
164 if (::osl::FileBase::E_None == aPathItem.getFileStatus(aStatus))
165 return true;
166 }
167
168 return false;
169}
170
171} // namespace
172
173const OUString & ONSSInitializer::getMozillaCurrentProfile(const css::uno::Reference< css::uno::XComponentContext > &rxContext, bool bSetActive)
174{
176 return m_sNSSPath;
177 if (bSetActive)
178 m_bIsNSSinitialized = true;
179
180 // first, try to get the profile from "MOZILLA_CERTIFICATE_FOLDER"
181 const char* pEnv = getenv("MOZILLA_CERTIFICATE_FOLDER");
182 if (pEnv)
183 {
184 SAL_INFO(
185 "xmlsecurity.xmlsec",
186 "Using Mozilla profile from MOZILLA_CERTIFICATE_FOLDER=" << pEnv);
187 m_sNSSPath = OStringToOUString(pEnv, osl_getThreadTextEncoding());
188 }
189
190 // second, try to get saved user-preference
191 if (m_sNSSPath.isEmpty())
192 {
193 try
194 {
195 OUString sUserSetCertPath =
196 officecfg::Office::Common::Security::Scripting::CertDir::get().value_or(OUString());
197
198 if (lcl_pathExists(sUserSetCertPath))
199 {
200 SAL_INFO(
201 "xmlsecurity.xmlsec",
202 "Using Mozilla profile from /org.openoffice.Office.Common/"
203 "Security/Scripting/CertDir: " << sUserSetCertPath);
204 m_sNSSPath = sUserSetCertPath;
205 }
206 }
207 catch (const uno::Exception &)
208 {
209 TOOLS_WARN_EXCEPTION("xmlsecurity.xmlsec", "getMozillaCurrentProfile:");
210 }
211 }
212
213 // third, dig around to see if there's one default available
214 mozilla::MozillaProductType productTypes[3] = {
215 mozilla::MozillaProductType_Thunderbird,
216 mozilla::MozillaProductType_Firefox,
217 mozilla::MozillaProductType_Mozilla };
218
219 uno::Reference<uno::XInterface> xInstance = rxContext->getServiceManager()->createInstanceWithContext("com.sun.star.mozilla.MozillaBootstrap", rxContext);
220 OSL_ENSURE( xInstance.is(), "failed to create instance" );
221
222 uno::Reference<mozilla::XMozillaBootstrap> xMozillaBootstrap(xInstance,uno::UNO_QUERY);
223 OSL_ENSURE( xMozillaBootstrap.is(), "failed to create instance" );
224
225 if (xMozillaBootstrap.is())
226 {
227 for (auto const productTypeIter : productTypes)
228 {
229 OUString profile = xMozillaBootstrap->getDefaultProfile(productTypeIter);
230
231 if (!profile.isEmpty())
232 {
233 OUString sProfilePath = xMozillaBootstrap->getProfilePath(productTypeIter, profile);
234 if (m_sNSSPath.isEmpty())
235 {
236 SAL_INFO("xmlsecurity.xmlsec", "Using Mozilla profile " << sProfilePath);
237 m_sNSSPath = sProfilePath;
238 }
239 break;
240 }
241 }
242 }
243
244 SAL_INFO_IF(m_sNSSPath.isEmpty(), "xmlsecurity.xmlsec", "No Mozilla profile found");
245 return m_sNSSPath;
246}
247
248css::uno::Sequence<css::xml::crypto::NSSProfile> SAL_CALL ONSSInitializer::getNSSProfiles()
249{
251
252 std::vector<xml::crypto::NSSProfile> aProfileList;
253 aProfileList.reserve(10);
254
255 mozilla::MozillaProductType productTypes[3] = {
256 mozilla::MozillaProductType_Thunderbird,
257 mozilla::MozillaProductType_Firefox,
258 mozilla::MozillaProductType_Mozilla };
259
260 uno::Reference<uno::XInterface> xInstance = m_xContext->getServiceManager()->createInstanceWithContext("com.sun.star.mozilla.MozillaBootstrap", m_xContext);
261 OSL_ENSURE(xInstance.is(), "failed to create instance" );
262
263 uno::Reference<mozilla::XMozillaBootstrap> xMozillaBootstrap(xInstance,uno::UNO_QUERY);
264
265 if (xMozillaBootstrap.is())
266 {
267 for (auto const productTypeIter : productTypes)
268 {
269 uno::Sequence<OUString> aProductProfileList;
270 xMozillaBootstrap->getProfileList(productTypeIter, aProductProfileList);
271 for (const auto& sProfile : std::as_const(aProductProfileList))
272 aProfileList.push_back({sProfile, xMozillaBootstrap->getProfilePath(productTypeIter, sProfile), productTypeIter});
273 }
274 }
275
276 OUString sUserSelect;
277 try
278 {
279 sUserSelect = officecfg::Office::Common::Security::Scripting::CertDir::get().value_or(OUString());;
280 if (!lcl_pathExists(sUserSelect))
281 sUserSelect = OUString();
282 }
283 catch (const uno::Exception &)
284 {
285 TOOLS_WARN_EXCEPTION("xmlsecurity.xmlsec", "getMozillaCurrentProfile:");
286 }
287 aProfileList.push_back({"MANUAL", sUserSelect, mozilla::MozillaProductType_Default});
288
289 const char* pEnv = getenv("MOZILLA_CERTIFICATE_FOLDER");
290 aProfileList.push_back({"MOZILLA_CERTIFICATE_FOLDER",
291 pEnv ? OStringToOUString(pEnv, osl_getThreadTextEncoding()) : OUString(),
292 mozilla::MozillaProductType_Default});
293
294 return comphelper::containerToSequence(aProfileList);
295}
296
299
301{
303 return m_sNSSPath;
304};
305
307{
308 return m_bIsNSSinitialized;
309}
310
311ONSSInitializer::ONSSInitializer(css::uno::Reference< css::uno::XComponentContext > xContext)
312 : m_xContext(std::move(xContext))
313{
314}
315
317{
318}
319
320namespace
321{
322
323//Older versions of Firefox (FF), for example FF2, and Thunderbird (TB) 2 write
324//the roots certificate module (libnssckbi.so), which they use, into the
325//profile. This module will then already be loaded during NSS_Init (and the
326//other init functions). This fails in two cases. First, FF3 was used to create
327//the profile, or possibly used that profile before, and second the profile was
328//used on a different platform.
329//
330//Then one needs to add the roots module oneself. This should be done with
331//SECMOD_LoadUserModule rather than SECMOD_AddNewModule. The latter would write
332//the location of the roots module to the profile, which makes FF2 and TB2 use
333//it instead of their own module.
334//
335//When using SYSTEM_NSS then the libnss3.so lib is typically found in /usr/lib.
336//This folder may, however, NOT contain the roots certificate module. That is,
337//just providing the library name in SECMOD_LoadUserModule or
338//SECMOD_AddNewModule will FAIL to load the mozilla unless the LD_LIBRARY_PATH
339//contains an FF or TB installation.
340//ATTENTION: DO NOT call this function directly instead use initNSS
341//return true - whole initialization was successful
342//param out_nss_init = true: at least the NSS initialization (NSS_InitReadWrite
343//was successful and therefore NSS_Shutdown should be called when terminating.
344bool nsscrypto_initialize(css::uno::Reference<css::uno::XComponentContext> const & rxContext, bool & out_nss_init)
345{
346 // this method must be called only once, no need for additional lock
347 OString sCertDir;
348
349#ifdef XMLSEC_CRYPTO_NSS
350 sCertDir = OUStringToOString(ONSSInitializer::getMozillaCurrentProfile(rxContext, true), osl_getThreadTextEncoding());
351#else
352 (void) rxContext;
353#endif
354 SAL_INFO("xmlsecurity.xmlsec", "Using profile: " << sCertDir );
355
356 PR_Init( PR_USER_THREAD, PR_PRIORITY_NORMAL, 1 ) ;
357
358 bool bSuccess = false;
359 // there might be no profile
360 if (!sCertDir.isEmpty())
361 {
362 if (sCertDir.indexOf(':') == -1) //might be env var with explicit prefix
363 {
364 OUString sCertDirURL;
365 osl::FileBase::getFileURLFromSystemPath(
366 OStringToOUString(sCertDir, osl_getThreadTextEncoding()),
367 sCertDirURL);
368 osl::DirectoryItem item;
369 if (osl::FileBase::E_NOENT != osl::DirectoryItem::get(sCertDirURL + "/cert8.db", item) &&
370 osl::FileBase::E_NOENT == osl::DirectoryItem::get(sCertDirURL + "/cert9.db", item))
371 {
372 SAL_INFO("xmlsecurity.xmlsec", "nsscrypto_initialize: trying to avoid profile migration");
373 sCertDir = "dbm:" + sCertDir;
374 }
375 }
376 if (NSS_InitReadWrite(sCertDir.getStr()) != SECSuccess)
377 {
378 SAL_INFO("xmlsecurity.xmlsec", "Initializing NSS with profile failed.");
379 int errlen = PR_GetErrorTextLength();
380 if (errlen > 0)
381 {
382 std::unique_ptr<char[]> const error(new char[errlen + 1]);
383 PR_GetErrorText(error.get());
384 SAL_INFO("xmlsecurity.xmlsec", error.get());
385 }
386 }
387 else
388 {
389 bSuccess = true;
390 }
391 }
392
393 if (!bSuccess) // Try to create a database in temp dir
394 {
395 SAL_INFO("xmlsecurity.xmlsec", "Initializing NSS with a temporary profile.");
396 OUString rString = (*getInitNSSPrivate())->getTempDatabasePath();
397
398 if (NSS_InitReadWrite(rString.toUtf8().getStr()) != SECSuccess)
399 {
400 SAL_INFO("xmlsecurity.xmlsec", "Initializing NSS with a temporary profile.");
401 int errlen = PR_GetErrorTextLength();
402 if(errlen > 0)
403 {
404 std::unique_ptr<char[]> const error(new char[errlen + 1]);
405 PR_GetErrorText(error.get());
406 SAL_INFO("xmlsecurity.xmlsec", error.get());
407 }
408 return false;
409 }
410 }
411
412 // Initialize and set empty password if needed
413 // note: it's possible that the first NSS_InitReadWrite() succeeds by
414 // creating a new DB; in this case it may also be necessary to call
415 // PK11_InitPin()
416 PK11SlotInfo* pSlot = PK11_GetInternalKeySlot();
417 if (pSlot)
418 {
419 if (PK11_NeedUserInit(pSlot))
420 PK11_InitPin(pSlot, nullptr, nullptr);
421 PK11_FreeSlot(pSlot);
422 }
423
424 out_nss_init = true;
425
426#ifdef XMLSEC_CRYPTO_NSS
427 bool return_value = true;
428
429#if defined SYSTEM_NSS || defined IOS // The statically linked nss on iOS acts as a "system" nss in this regards
430 if (!SECMOD_HasRootCerts())
431#endif
432 {
433 deleteRootsModule();
434
435#ifdef IOS // Use statically linked NSS
436 OUString rootModulePath("NSSCKBI");
437
438 if (true)
439#else
440#if defined SYSTEM_NSS || defined ANDROID
441 OUString rootModule("libnssckbi" SAL_DLLEXTENSION);
442#else
443 OUString rootModule("${LO_LIB_DIR}/libnssckbi" SAL_DLLEXTENSION);
444#endif
445 ::rtl::Bootstrap::expandMacros(rootModule);
446
447 OUString rootModulePath;
448 if (::osl::File::E_None == ::osl::File::getSystemPathFromFileURL(rootModule, rootModulePath))
449#endif
450 {
451 OString ospath = OUStringToOString(rootModulePath, osl_getThreadTextEncoding());
452 OString aStr = "name=\"" ROOT_CERTS "\" library=\"" + ospath + "\"";
453
454 SECMODModule * RootsModule =
455 SECMOD_LoadUserModule(
456 const_cast<char*>(aStr.getStr()),
457 nullptr, // no parent
458 PR_FALSE); // do not recurse
459
460 if (RootsModule)
461 {
462
463 bool found = RootsModule->loaded;
464
465 SECMOD_DestroyModule(RootsModule);
466 RootsModule = nullptr;
467 if (found)
468 SAL_INFO("xmlsecurity.xmlsec", "Added new root certificate module " ROOT_CERTS " contained in " << ospath);
469 else
470 {
471 SAL_INFO("xmlsecurity.xmlsec", "FAILED to load the new root certificate module " ROOT_CERTS "contained in " << ospath);
472 return_value = false;
473 }
474 }
475 else
476 {
477 SAL_INFO("xmlsecurity.xmlsec", "FAILED to add new root certificate module " ROOT_CERTS " contained in " << ospath);
478 return_value = false;
479
480 }
481 }
482 else
483 {
484 SAL_INFO("xmlsecurity.xmlsec", "Adding new root certificate module failed.");
485 return_value = false;
486 }
487 }
488
489 return return_value;
490#else
491 return true;
492#endif
493}
494
495} // namespace
496
497// must be extern "C" because we pass the function pointer to atexit
498extern "C" void nsscrypto_finalize()
499{
500 SECMODModule *RootsModule = SECMOD_FindModule(ROOT_CERTS);
501
502 if (RootsModule)
503 {
504
505 if (SECSuccess == SECMOD_UnloadUserModule(RootsModule))
506 {
507 SAL_INFO("xmlsecurity.xmlsec", "Unloaded module \"" ROOT_CERTS "\".");
508 }
509 else
510 {
511 SAL_INFO("xmlsecurity.xmlsec", "Failed unloading module \"" ROOT_CERTS "\".");
512 }
513 SECMOD_DestroyModule(RootsModule);
514 }
515 else
516 {
517 SAL_INFO("xmlsecurity.xmlsec", "Unloading module \"" ROOT_CERTS "\" failed because it was not found.");
518 }
519 PK11_LogoutAll();
520 (void)NSS_Shutdown();
521
522 (*getInitNSSPrivate())->reset();
523}
524
525
527{
528}
529
530bool ONSSInitializer::initNSS( const css::uno::Reference< css::uno::XComponentContext > &rxContext )
531{
532 static bool gbInitialized = [&rxContext]()
533 {
534 bool bNSSInit = false;
535 bool bInitialized = nsscrypto_initialize( rxContext, bNSSInit );
536 if (bNSSInit)
537 atexit(nsscrypto_finalize);
538 return bInitialized;
539 }();
540 return gbInitialized;
541}
542
543css::uno::Reference< css::xml::crypto::XDigestContext > SAL_CALL ONSSInitializer::getDigestContext( ::sal_Int32 nDigestID, const css::uno::Sequence< css::beans::NamedValue >& aParams )
544{
545 SECOidTag nNSSDigestID = SEC_OID_UNKNOWN;
546 sal_Int32 nDigestLength = 0;
547 bool b1KData = false;
548 if ( nDigestID == css::xml::crypto::DigestID::SHA256
549 || nDigestID == css::xml::crypto::DigestID::SHA256_1K )
550 {
551 nNSSDigestID = SEC_OID_SHA256;
552 nDigestLength = 32;
553 b1KData = ( nDigestID == css::xml::crypto::DigestID::SHA256_1K );
554 }
555 else if ( nDigestID == css::xml::crypto::DigestID::SHA1
556 || nDigestID == css::xml::crypto::DigestID::SHA1_1K )
557 {
558 nNSSDigestID = SEC_OID_SHA1;
559 nDigestLength = 20;
560 b1KData = ( nDigestID == css::xml::crypto::DigestID::SHA1_1K );
561 }
562 else if ( nDigestID == css::xml::crypto::DigestID::SHA512
563 || nDigestID == css::xml::crypto::DigestID::SHA512_1K )
564 {
565 nNSSDigestID = SEC_OID_SHA512;
566 nDigestLength = 64;
567 b1KData = ( nDigestID == css::xml::crypto::DigestID::SHA512_1K );
568 }
569 else
570 throw css::lang::IllegalArgumentException("Unexpected digest requested.", css::uno::Reference< css::uno::XInterface >(), 1 );
571
572 if ( aParams.hasElements() )
573 throw css::lang::IllegalArgumentException("Unexpected arguments provided for digest creation.", css::uno::Reference< css::uno::XInterface >(), 2 );
574
575 css::uno::Reference< css::xml::crypto::XDigestContext > xResult;
576 if( initNSS( m_xContext ) )
577 {
578 PK11Context* pContext = PK11_CreateDigestContext( nNSSDigestID );
579 if ( pContext && PK11_DigestBegin( pContext ) == SECSuccess )
580 xResult = new ODigestContext( pContext, nDigestLength, b1KData );
581 }
582
583 return xResult;
584}
585
586css::uno::Reference< css::xml::crypto::XCipherContext > SAL_CALL ONSSInitializer::getCipherContext( ::sal_Int32 nCipherID, const css::uno::Sequence< ::sal_Int8 >& aKey, const css::uno::Sequence< ::sal_Int8 >& aInitializationVector, sal_Bool bEncryption, const css::uno::Sequence< css::beans::NamedValue >& aParams )
587{
588 CK_MECHANISM_TYPE nNSSCipherID = 0;
589 bool bW3CPadding = false;
590 if ( nCipherID != css::xml::crypto::CipherID::AES_CBC_W3C_PADDING )
591 throw css::lang::IllegalArgumentException("Unexpected cipher requested.", css::uno::Reference< css::uno::XInterface >(), 1 );
592
593 nNSSCipherID = CKM_AES_CBC;
594 bW3CPadding = true;
595
596 if ( aKey.getLength() != 16 && aKey.getLength() != 24 && aKey.getLength() != 32 )
597 throw css::lang::IllegalArgumentException("Unexpected key length.", css::uno::Reference< css::uno::XInterface >(), 2 );
598
599 if ( aParams.hasElements() )
600 throw css::lang::IllegalArgumentException("Unexpected arguments provided for cipher creation.", css::uno::Reference< css::uno::XInterface >(), 5 );
601
602 css::uno::Reference< css::xml::crypto::XCipherContext > xResult;
603 if( initNSS( m_xContext ) )
604 {
605 if ( aInitializationVector.getLength() != PK11_GetIVLength( nNSSCipherID ) )
606 throw css::lang::IllegalArgumentException("Unexpected length of initialization vector.", css::uno::Reference< css::uno::XInterface >(), 3 );
607
608 xResult = OCipherContext::Create( nNSSCipherID, aKey, aInitializationVector, bEncryption, bW3CPadding );
609 }
610
611 return xResult;
612}
613
614/* XServiceInfo */
616{
617 return "com.sun.star.xml.crypto.NSSInitializer";
618}
619
620sal_Bool SAL_CALL ONSSInitializer::supportsService( const OUString& rServiceName )
621{
622 return cppu::supportsService(this, rServiceName);
623}
624
625cssu::Sequence< OUString > SAL_CALL ONSSInitializer::getSupportedServiceNames( )
626{
627 return { NSS_SERVICE_NAME };
628}
629
630#ifndef XMLSEC_CRYPTO_NSS
631extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
633 uno::XComponentContext* pCtx, uno::Sequence<uno::Any> const& /*rSeq*/)
634{
635 return cppu::acquire(new ONSSInitializer(pCtx));
636}
637#endif
638
639/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Reference< XComponentContext > m_xContext
static css::uno::Reference< css::xml::crypto::XCipherContext > Create(CK_MECHANISM_TYPE nNSSCipherID, const css::uno::Sequence< ::sal_Int8 > &aKey, const css::uno::Sequence< ::sal_Int8 > &aInitializationVector, bool bEncryption, bool bW3CPadding)
static bool initNSS(const css::uno::Reference< css::uno::XComponentContext > &rxContext)
css::uno::Reference< css::uno::XComponentContext > m_xContext
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual OUString SAL_CALL getImplementationName() override
virtual ~ONSSInitializer() override
static OUString m_sNSSPath
virtual css::uno::Reference< css::xml::crypto::XDigestContext > SAL_CALL getDigestContext(::sal_Int32 nDigestID, const css::uno::Sequence< css::beans::NamedValue > &aParams) override
static bool m_bIsNSSinitialized
virtual css::uno::Reference< css::xml::crypto::XCipherContext > SAL_CALL getCipherContext(::sal_Int32 nCipherID, const css::uno::Sequence< ::sal_Int8 > &aKey, const css::uno::Sequence< ::sal_Int8 > &aInitializationVector, sal_Bool bEncryption, const css::uno::Sequence< css::beans::NamedValue > &aParams) override
virtual css::uno::Sequence< css::xml::crypto::NSSProfile > SAL_CALL getNSSProfiles() override
virtual sal_Bool SAL_CALL getIsNSSinitialized() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
static const OUString & getMozillaCurrentProfile(const css::uno::Reference< css::uno::XComponentContext > &rxContext, bool bSetActive=false)
virtual OUString SAL_CALL getNSSPath() override
#define TOOLS_WARN_EXCEPTION(area, stream)
#define SAL_INFO_IF(condition, area, stream)
#define SAL_INFO(area, stream)
aStr
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
std::shared_ptr< osl::Mutex > const & lock()
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
int i
module
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
SAL_DLLPUBLIC_EXPORT uno::XInterface * com_sun_star_xml_crypto_NSSInitializer_get_implementation(uno::XComponentContext *pCtx, uno::Sequence< uno::Any > const &)
static void nsscrypto_finalize()
#define ROOT_CERTS
constexpr OUStringLiteral NSS_SERVICE_NAME
unsigned char sal_Bool