fdo#46808, convert comphelper::OStorageHelper to XComponentContext
And drop the optional parameter on CreatePackageEncryptionData because no-one is using it. Change-Id: Ia83ebfc099dd121273d2c39431d015b3bc0abd81
This commit is contained in:
@@ -23,7 +23,6 @@
|
|||||||
|
|
||||||
#include <com/sun/star/uno/Sequence.hxx>
|
#include <com/sun/star/uno/Sequence.hxx>
|
||||||
#include <com/sun/star/uno/Reference.hxx>
|
#include <com/sun/star/uno/Reference.hxx>
|
||||||
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
|
|
||||||
#include <com/sun/star/embed/ElementModes.hpp>
|
#include <com/sun/star/embed/ElementModes.hpp>
|
||||||
#include "comphelper/comphelperdllapi.h"
|
#include "comphelper/comphelperdllapi.h"
|
||||||
|
|
||||||
@@ -173,9 +172,7 @@ public:
|
|||||||
|
|
||||||
static ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >
|
static ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >
|
||||||
CreatePackageEncryptionData(
|
CreatePackageEncryptionData(
|
||||||
const ::rtl::OUString& aPassword,
|
const ::rtl::OUString& aPassword );
|
||||||
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xSF
|
|
||||||
= ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >() );
|
|
||||||
|
|
||||||
static sal_Bool IsValidZipEntryFileName( const ::rtl::OUString& aName, sal_Bool bSlashAllowed );
|
static sal_Bool IsValidZipEntryFileName( const ::rtl::OUString& aName, sal_Bool bSlashAllowed );
|
||||||
static sal_Bool IsValidZipEntryFileName( const sal_Unicode *pChar, sal_Int32 nLength, sal_Bool bSlashAllowed );
|
static sal_Bool IsValidZipEntryFileName( const sal_Unicode *pChar, sal_Int32 nLength, sal_Bool bSlashAllowed );
|
||||||
|
@@ -29,6 +29,7 @@
|
|||||||
#include <com/sun/star/beans/PropertyValue.hpp>
|
#include <com/sun/star/beans/PropertyValue.hpp>
|
||||||
#include <com/sun/star/beans/NamedValue.hpp>
|
#include <com/sun/star/beans/NamedValue.hpp>
|
||||||
#include <com/sun/star/beans/IllegalTypeException.hpp>
|
#include <com/sun/star/beans/IllegalTypeException.hpp>
|
||||||
|
#include <com/sun/star/xml/crypto/NSSInitializer.hpp>
|
||||||
#include <com/sun/star/xml/crypto/XDigestContext.hpp>
|
#include <com/sun/star/xml/crypto/XDigestContext.hpp>
|
||||||
#include <com/sun/star/xml/crypto/XDigestContextSupplier.hpp>
|
#include <com/sun/star/xml/crypto/XDigestContextSupplier.hpp>
|
||||||
#include <com/sun/star/xml/crypto/DigestID.hpp>
|
#include <com/sun/star/xml/crypto/DigestID.hpp>
|
||||||
@@ -376,7 +377,7 @@ uno::Reference< embed::XStorage > OStorageHelper::GetStorageOfFormatFromStream(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
uno::Sequence< beans::NamedValue > OStorageHelper::CreatePackageEncryptionData( const ::rtl::OUString& aPassword, const uno::Reference< lang::XMultiServiceFactory >& xSF )
|
uno::Sequence< beans::NamedValue > OStorageHelper::CreatePackageEncryptionData( const ::rtl::OUString& aPassword )
|
||||||
{
|
{
|
||||||
// TODO/LATER: Should not the method be part of DocPasswordHelper?
|
// TODO/LATER: Should not the method be part of DocPasswordHelper?
|
||||||
uno::Sequence< beans::NamedValue > aEncryptionData;
|
uno::Sequence< beans::NamedValue > aEncryptionData;
|
||||||
@@ -386,11 +387,9 @@ uno::Sequence< beans::NamedValue > OStorageHelper::CreatePackageEncryptionData(
|
|||||||
// generate SHA256 start key
|
// generate SHA256 start key
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
uno::Reference< lang::XMultiServiceFactory > xFactory = xSF.is() ? xSF : ::comphelper::getProcessServiceFactory();
|
uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
|
||||||
if ( !xFactory.is() )
|
|
||||||
throw uno::RuntimeException();
|
|
||||||
|
|
||||||
uno::Reference< xml::crypto::XDigestContextSupplier > xDigestContextSupplier( xFactory->createInstance( OUString( "com.sun.star.xml.crypto.NSSInitializer" ) ), uno::UNO_QUERY_THROW );
|
uno::Reference< xml::crypto::XNSSInitializer > xDigestContextSupplier = xml::crypto::NSSInitializer::create(xContext);
|
||||||
uno::Reference< xml::crypto::XDigestContext > xDigestContext( xDigestContextSupplier->getDigestContext( xml::crypto::DigestID::SHA256, uno::Sequence< beans::NamedValue >() ), uno::UNO_SET_THROW );
|
uno::Reference< xml::crypto::XDigestContext > xDigestContext( xDigestContextSupplier->getDigestContext( xml::crypto::DigestID::SHA256, uno::Sequence< beans::NamedValue >() ), uno::UNO_SET_THROW );
|
||||||
|
|
||||||
::rtl::OString aUTF8Password( ::rtl::OUStringToOString( aPassword, RTL_TEXTENCODING_UTF8 ) );
|
::rtl::OString aUTF8Password( ::rtl::OUStringToOString( aPassword, RTL_TEXTENCODING_UTF8 ) );
|
||||||
|
Reference in New Issue
Block a user