summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cui/source/options/optinet2.cxx7
-rw-r--r--filter/source/pdf/impdialog.cxx14
-rw-r--r--offapi/UnoApi_offapi.mk6
-rw-r--r--offapi/com/sun/star/security/DocumentDigitalSignatures.idl18
-rw-r--r--sfx2/source/dialog/dinfdlg.cxx35
-rw-r--r--sfx2/source/doc/docfile.cxx168
-rw-r--r--sfx2/source/doc/docmacromode.cxx23
-rw-r--r--sfx2/source/doc/objmisc.cxx6
-rw-r--r--sfx2/source/doc/objserv.cxx9
-rw-r--r--sfx2/source/doc/objstor.cxx14
-rw-r--r--uui/source/secmacrowarnings.cxx25
-rw-r--r--uui/source/sslwarndlg.cxx6
-rw-r--r--uui/source/unknownauthdlg.cxx5
-rw-r--r--xmlsecurity/workben/signaturetest.cxx36
14 files changed, 173 insertions, 199 deletions
diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx
index 859e83a88552..51ba59543806 100644
--- a/cui/source/options/optinet2.cxx
+++ b/cui/source/options/optinet2.cxx
@@ -64,7 +64,7 @@
#include <svx/svxids.hrc> // slot ids, mostly for changetracking
// for security TP
-#include <com/sun/star/security/XDocumentDigitalSignatures.hpp>
+#include <com/sun/star/security/DocumentDigitalSignatures.hpp>
#ifdef UNX
#include <sys/stat.h>
@@ -867,9 +867,8 @@ IMPL_LINK_NOARG(SvxSecurityTabPage, MacroSecPBHdl)
try
{
Reference< security::XDocumentDigitalSignatures > xD(
- comphelper::getProcessServiceFactory()->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.security.DocumentDigitalSignatures" ) ) ), UNO_QUERY );
- if ( xD.is() )
- xD->manageTrustedSources();
+ security::DocumentDigitalSignatures::createDefault(comphelper::getProcessComponentContext() ) );
+ xD->manageTrustedSources();
}
catch (const Exception& e)
{
diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx
index d19c87e47820..7ef26b1d3e55 100644
--- a/filter/source/pdf/impdialog.cxx
+++ b/filter/source/pdf/impdialog.cxx
@@ -43,7 +43,7 @@
#include "com/sun/star/container/XIndexAccess.hpp"
#include "com/sun/star/frame/XController.hpp"
#include "com/sun/star/view/XSelectionSupplier.hpp"
-#include "com/sun/star/security/XDocumentDigitalSignatures.hpp"
+#include "com/sun/star/security/DocumentDigitalSignatures.hpp"
#include "com/sun/star/security/XCertificate.hpp"
#include <boost/shared_ptr.hpp>
@@ -1709,17 +1709,9 @@ ImpPDFTabSigningPage::~ImpPDFTabSigningPage()
IMPL_LINK_NOARG( ImpPDFTabSigningPage, ClickmaPbSignCertSelect )
{
- uno::Sequence< uno::Any > aArgs( 2 );
- aArgs[0] <<= rtl::OUString("1.2");
- aArgs[1] <<= sal_False;
-
Reference< security::XDocumentDigitalSignatures > xSigner(
- comphelper::getProcessServiceFactory()->createInstanceWithArguments(
- rtl::OUString( "com.sun.star.security.DocumentDigitalSignatures" ), aArgs ),
- uno::UNO_QUERY );
-
- if ( !xSigner.is() )
- return 0;
+ security::DocumentDigitalSignatures::createWithVersion(
+ comphelper::getProcessComponentContext(), rtl::OUString("1.2") ) );
maSignCertificate = xSigner->chooseCertificate();
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 64d1a4de6739..0abad1a6b5de 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -214,6 +214,9 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/resource,\
StringResourceWithLocation \
StringResourceWithStorage \
))
+$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/security,\
+ DocumentDigitalSignatures \
+))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/scanner,\
ScannerManager \
))
@@ -1046,9 +1049,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/sdbcx,\
View \
ViewDescriptor \
))
-$(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/security,\
- DocumentDigitalSignatures \
-))
$(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/setup,\
ProductRegistration \
Setup \
diff --git a/offapi/com/sun/star/security/DocumentDigitalSignatures.idl b/offapi/com/sun/star/security/DocumentDigitalSignatures.idl
index 9eb7a9c375c6..b406cfd4ab8f 100644
--- a/offapi/com/sun/star/security/DocumentDigitalSignatures.idl
+++ b/offapi/com/sun/star/security/DocumentDigitalSignatures.idl
@@ -33,8 +33,22 @@ module com { module sun { module star { module security {
* Service of DocumentDigitalSignatures
*/
- service Decryptor {
- interface XDocumentDigitalSignatures ;
+service DocumentDigitalSignatures : XDocumentDigitalSignatures
+{
+ /* default constructor */
+ createDefault();
+
+ /**
+ @param ODFVersion
+ the version of the signature
+ */
+ createWithVersion([in] string ODFVersion);
+
+ /**
+ @param ODFVersion
+ the version of the signature
+ */
+ createWithVersionAndValidSignature([in] string ODFVersion, [in] boolean HasValidDocumentSignature);
};
} ; } ; } ; } ;
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index a8cf492f7e5f..78dbfe341121 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -33,7 +33,7 @@
#include <comphelper/string.hxx>
#include <com/sun/star/security/DocumentSignatureInformation.hpp>
-#include <com/sun/star/security/XDocumentDigitalSignatures.hpp>
+#include <com/sun/star/security/DocumentDigitalSignatures.hpp>
#include <unotools/syslocale.hxx>
#include <rtl/math.hxx>
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
@@ -938,26 +938,23 @@ void SfxDocumentPage::ImplUpdateSignatures()
if ( pMedium && !pMedium->GetName().isEmpty() && pMedium->GetStorage().is() )
{
Reference< security::XDocumentDigitalSignatures > xD(
- comphelper::getProcessServiceFactory()->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.security.DocumentDigitalSignatures" ) ) ), uno::UNO_QUERY );
-
- if ( xD.is() )
+ security::DocumentDigitalSignatures::createDefault(comphelper::getProcessComponentContext()) );
+
+ String s;
+ Sequence< security::DocumentSignatureInformation > aInfos;
+ aInfos = xD->verifyDocumentContentSignatures( pMedium->GetZipStorageToSign_Impl(),
+ uno::Reference< io::XInputStream >() );
+ if ( aInfos.getLength() > 1 )
+ s = aMultiSignedStr;
+ else if ( aInfos.getLength() == 1 )
{
- String s;
- Sequence< security::DocumentSignatureInformation > aInfos;
- aInfos = xD->verifyDocumentContentSignatures( pMedium->GetZipStorageToSign_Impl(),
- uno::Reference< io::XInputStream >() );
- if ( aInfos.getLength() > 1 )
- s = aMultiSignedStr;
- else if ( aInfos.getLength() == 1 )
- {
- rtl::OUString aCN_Id("CN");
- const security::DocumentSignatureInformation& rInfo = aInfos[ 0 ];
- s = GetDateTimeString( rInfo.SignatureDate, rInfo.SignatureTime );
- s.AppendAscii( ", " );
- s += GetContentPart( rInfo.Signer->getSubjectName(), aCN_Id );
- }
- aSignedValFt.SetText( s );
+ rtl::OUString aCN_Id("CN");
+ const security::DocumentSignatureInformation& rInfo = aInfos[ 0 ];
+ s = GetDateTimeString( rInfo.SignatureDate, rInfo.SignatureTime );
+ s.AppendAscii( ", " );
+ s += GetContentPart( rInfo.Signer->getSubjectName(), aCN_Id );
}
+ aSignedValFt.SetText( s );
}
}
}
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 09966767cf86..1a8c61976cc3 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -62,7 +62,7 @@
#include <cppuhelper/implbase1.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/security/DocumentSignatureInformation.hpp>
-#include <com/sun/star/security/XDocumentDigitalSignatures.hpp>
+#include <com/sun/star/security/DocumentDigitalSignatures.hpp>
#include <tools/urlobj.hxx>
#include <unotools/tempfile.hxx>
#include <comphelper/processfactory.hxx>
@@ -3371,105 +3371,97 @@ sal_Bool SfxMedium::SignContents_Impl( sal_Bool bScriptingContent, const ::rtl::
{
// The component should know if there was a valid document signature, since
// it should show a warning in this case
- uno::Sequence< uno::Any > aArgs( 2 );
- aArgs[0] <<= aODFVersion;
- aArgs[1] <<= bHasValidDocumentSignature;
- ::com::sun::star::uno::Reference< ::com::sun::star::security::XDocumentDigitalSignatures > xSigner(
- comphelper::getProcessServiceFactory()->createInstanceWithArguments(
- rtl::OUString( "com.sun.star.security.DocumentDigitalSignatures" ),
- aArgs ),
- ::com::sun::star::uno::UNO_QUERY );
-
- if ( xSigner.is() )
- {
- uno::Reference< embed::XStorage > xWriteableZipStor;
- if ( !IsReadOnly() )
- {
- // we can reuse the temporary file if there is one already
- CreateTempFile( false );
- GetMedium_Impl();
+ uno::Reference< security::XDocumentDigitalSignatures > xSigner(
+ security::DocumentDigitalSignatures::createWithVersionAndValidSignature(
+ comphelper::getProcessComponentContext(), aODFVersion, bHasValidDocumentSignature ) );
- try
- {
- if ( !pImp->xStream.is() )
- throw uno::RuntimeException();
+ uno::Reference< embed::XStorage > xWriteableZipStor;
+ if ( !IsReadOnly() )
+ {
+ // we can reuse the temporary file if there is one already
+ CreateTempFile( false );
+ GetMedium_Impl();
- xWriteableZipStor = ::comphelper::OStorageHelper::GetStorageOfFormatFromStream( ZIP_STORAGE_FORMAT_STRING, pImp->xStream );
- if ( !xWriteableZipStor.is() )
- throw uno::RuntimeException();
+ try
+ {
+ if ( !pImp->xStream.is() )
+ throw uno::RuntimeException();
- uno::Reference< embed::XStorage > xMetaInf = xWriteableZipStor->openStorageElement(
- ::rtl::OUString( "META-INF" ),
- embed::ElementModes::READWRITE );
- if ( !xMetaInf.is() )
- throw uno::RuntimeException();
+ xWriteableZipStor = ::comphelper::OStorageHelper::GetStorageOfFormatFromStream( ZIP_STORAGE_FORMAT_STRING, pImp->xStream );
+ if ( !xWriteableZipStor.is() )
+ throw uno::RuntimeException();
- if ( bScriptingContent )
- {
- // If the signature has already the document signature it will be removed
- // after the scripting signature is inserted.
- uno::Reference< io::XStream > xStream(
- xMetaInf->openStreamElement( xSigner->getScriptingContentSignatureDefaultStreamName(),
- embed::ElementModes::READWRITE ),
- uno::UNO_SET_THROW );
-
- if ( xSigner->signScriptingContent( GetZipStorageToSign_Impl(), xStream ) )
- {
- // remove the document signature if any
- ::rtl::OUString aDocSigName = xSigner->getDocumentContentSignatureDefaultStreamName();
- if ( !aDocSigName.isEmpty() && xMetaInf->hasByName( aDocSigName ) )
- xMetaInf->removeElement( aDocSigName );
-
- uno::Reference< embed::XTransactedObject > xTransact( xMetaInf, uno::UNO_QUERY_THROW );
- xTransact->commit();
- xTransact.set( xWriteableZipStor, uno::UNO_QUERY_THROW );
- xTransact->commit();
-
- // the temporary file has been written, commit it to the original file
- Commit();
- bChanges = true;
- }
- }
- else
- {
- uno::Reference< io::XStream > xStream(
- xMetaInf->openStreamElement( xSigner->getDocumentContentSignatureDefaultStreamName(),
- embed::ElementModes::READWRITE ),
- uno::UNO_SET_THROW );
+ uno::Reference< embed::XStorage > xMetaInf = xWriteableZipStor->openStorageElement(
+ ::rtl::OUString( "META-INF" ),
+ embed::ElementModes::READWRITE );
+ if ( !xMetaInf.is() )
+ throw uno::RuntimeException();
- if ( xSigner->signDocumentContent( GetZipStorageToSign_Impl(), xStream ) )
- {
- uno::Reference< embed::XTransactedObject > xTransact( xMetaInf, uno::UNO_QUERY_THROW );
- xTransact->commit();
- xTransact.set( xWriteableZipStor, uno::UNO_QUERY_THROW );
- xTransact->commit();
-
- // the temporary file has been written, commit it to the original file
- Commit();
- bChanges = true;
- }
+ if ( bScriptingContent )
+ {
+ // If the signature has already the document signature it will be removed
+ // after the scripting signature is inserted.
+ uno::Reference< io::XStream > xStream(
+ xMetaInf->openStreamElement( xSigner->getScriptingContentSignatureDefaultStreamName(),
+ embed::ElementModes::READWRITE ),
+ uno::UNO_SET_THROW );
+
+ if ( xSigner->signScriptingContent( GetZipStorageToSign_Impl(), xStream ) )
+ {
+ // remove the document signature if any
+ ::rtl::OUString aDocSigName = xSigner->getDocumentContentSignatureDefaultStreamName();
+ if ( !aDocSigName.isEmpty() && xMetaInf->hasByName( aDocSigName ) )
+ xMetaInf->removeElement( aDocSigName );
+
+ uno::Reference< embed::XTransactedObject > xTransact( xMetaInf, uno::UNO_QUERY_THROW );
+ xTransact->commit();
+ xTransact.set( xWriteableZipStor, uno::UNO_QUERY_THROW );
+ xTransact->commit();
+
+ // the temporary file has been written, commit it to the original file
+ Commit();
+ bChanges = true;
}
}
- catch ( const uno::Exception& )
+ else
{
- OSL_FAIL( "Couldn't use signing functionality!\n" );
+ uno::Reference< io::XStream > xStream(
+ xMetaInf->openStreamElement( xSigner->getDocumentContentSignatureDefaultStreamName(),
+ embed::ElementModes::READWRITE ),
+ uno::UNO_SET_THROW );
+
+ if ( xSigner->signDocumentContent( GetZipStorageToSign_Impl(), xStream ) )
+ {
+ uno::Reference< embed::XTransactedObject > xTransact( xMetaInf, uno::UNO_QUERY_THROW );
+ xTransact->commit();
+ xTransact.set( xWriteableZipStor, uno::UNO_QUERY_THROW );
+ xTransact->commit();
+
+ // the temporary file has been written, commit it to the original file
+ Commit();
+ bChanges = true;
+ }
}
+ }
+ catch ( const uno::Exception& )
+ {
+ OSL_FAIL( "Couldn't use signing functionality!\n" );
+ }
- CloseAndRelease();
+ CloseAndRelease();
+ }
+ else
+ {
+ try
+ {
+ if ( bScriptingContent )
+ xSigner->showScriptingContentSignatures( GetZipStorageToSign_Impl(), uno::Reference< io::XInputStream >() );
+ else
+ xSigner->showDocumentContentSignatures( GetZipStorageToSign_Impl(), uno::Reference< io::XInputStream >() );
}
- else
+ catch( const uno::Exception& )
{
- try
- {
- if ( bScriptingContent )
- xSigner->showScriptingContentSignatures( GetZipStorageToSign_Impl(), uno::Reference< io::XInputStream >() );
- else
- xSigner->showDocumentContentSignatures( GetZipStorageToSign_Impl(), uno::Reference< io::XInputStream >() );
- }
- catch( const uno::Exception& )
- {
- OSL_FAIL( "Couldn't use signing functionality!\n" );
- }
+ OSL_FAIL( "Couldn't use signing functionality!\n" );
}
}
diff --git a/sfx2/source/doc/docmacromode.cxx b/sfx2/source/doc/docmacromode.cxx
index dc6395ef294a..47547569f58b 100644
--- a/sfx2/source/doc/docmacromode.cxx
+++ b/sfx2/source/doc/docmacromode.cxx
@@ -26,7 +26,7 @@
#include <com/sun/star/task/ErrorCodeRequest.hpp>
#include <com/sun/star/task/DocumentMacroConfirmationRequest.hpp>
#include <com/sun/star/task/InteractionClassification.hpp>
-#include <com/sun/star/security/XDocumentDigitalSignatures.hpp>
+#include <com/sun/star/security/DocumentDigitalSignatures.hpp>
#include <com/sun/star/script/XLibraryQueryExecutable.hpp>
#include <com/sun/star/script/vba/XVBACompatibility.hpp>
@@ -56,6 +56,7 @@ namespace sfx2
using ::com::sun::star::task::DocumentMacroConfirmationRequest;
using ::com::sun::star::task::ErrorCodeRequest;
using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::security::DocumentDigitalSignatures;
using ::com::sun::star::security::XDocumentDigitalSignatures;
using ::com::sun::star::security::DocumentSignatureInformation;
using ::com::sun::star::embed::XStorage;
@@ -224,20 +225,16 @@ namespace sfx2
// get document location from medium name and check whether it is a trusted one
// the service is created ohne document version, since it is not of interest here
- ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
- Reference< XDocumentDigitalSignatures > xSignatures;
- if ( aContext.createComponent( "com.sun.star.security.DocumentDigitalSignatures", xSignatures ) )
- {
- INetURLObject aURLReferer( sReferrer );
+ Reference< XDocumentDigitalSignatures > xSignatures(DocumentDigitalSignatures::createDefault(::comphelper::getProcessComponentContext()));
+ INetURLObject aURLReferer( sReferrer );
- ::rtl::OUString aLocation;
- if ( aURLReferer.removeSegment() )
- aLocation = aURLReferer.GetMainURL( INetURLObject::NO_DECODE );
+ ::rtl::OUString aLocation;
+ if ( aURLReferer.removeSegment() )
+ aLocation = aURLReferer.GetMainURL( INetURLObject::NO_DECODE );
- if ( !aLocation.isEmpty() && xSignatures->isLocationTrusted( aLocation ) )
- {
- return allowMacroExecution();
- }
+ if ( !aLocation.isEmpty() && xSignatures->isLocationTrusted( aLocation ) )
+ {
+ return allowMacroExecution();
}
// at this point it is clear that the document is not in the secure location
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index 842d716c2be7..a30765346b15 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -67,7 +67,7 @@
#include <comphelper/processfactory.hxx>
#include <comphelper/string.hxx>
-#include <com/sun/star/security/XDocumentDigitalSignatures.hpp>
+#include <com/sun/star/security/DocumentDigitalSignatures.hpp>
#include <com/sun/star/task/DocumentMacroConfirmationRequest.hpp>
#include <com/sun/star/task/InteractionClassification.hpp>
#include <com/sun/star/frame/XModel.hpp>
@@ -1967,10 +1967,8 @@ sal_Bool SfxObjectShell_Impl::hasTrustedScriptingSignature( sal_Bool bAllowUIToA
catch( uno::Exception& )
{
}
- uno::Sequence< uno::Any > aArgs( 1 );
- aArgs[0] <<= aVersion;
- uno::Reference< security::XDocumentDigitalSignatures > xSigner( comphelper::getProcessServiceFactory()->createInstanceWithArguments( rtl::OUString( "com.sun.star.security.DocumentDigitalSignatures" ), aArgs ), uno::UNO_QUERY_THROW );
+ uno::Reference< security::XDocumentDigitalSignatures > xSigner( security::DocumentDigitalSignatures::createWithVersion(comphelper::getProcessComponentContext(), aVersion) );
if ( nScriptingSignatureState == SIGNATURESTATE_UNKNOWN
|| nScriptingSignatureState == SIGNATURESTATE_SIGNATURES_OK
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index 1bd9c9cd8a89..5046eca0c865 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -40,7 +40,7 @@
#include <com/sun/star/security/CertificateValidity.hpp>
#include <com/sun/star/security/DocumentSignatureInformation.hpp>
-#include <com/sun/star/security/XDocumentDigitalSignatures.hpp>
+#include <com/sun/star/security/DocumentDigitalSignatures.hpp>
#include <tools/urlobj.hxx>
#include <svl/whiter.hxx>
#include <vcl/msgbox.hxx>
@@ -1261,18 +1261,17 @@ uno::Sequence< security::DocumentSignatureInformation > SfxObjectShell::ImplAnal
{
if ( !xLocSigner.is() )
{
- uno::Sequence< uno::Any > aArgs( 1 );
- aArgs[0] <<= ::rtl::OUString();
+ ::rtl::OUString aVersion;
try
{
uno::Reference < beans::XPropertySet > xPropSet( GetStorage(), uno::UNO_QUERY_THROW );
- aArgs[0] = xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Version" ) ) );
+ xPropSet->getPropertyValue( ::rtl::OUString( "Version" ) ) >>= aVersion;
}
catch( uno::Exception& )
{
}
- xLocSigner.set( comphelper::getProcessServiceFactory()->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.security.DocumentDigitalSignatures" ) ), aArgs ), uno::UNO_QUERY_THROW );
+ xLocSigner.set( security::DocumentDigitalSignatures::createWithVersion(comphelper::getProcessComponentContext(), aVersion) );
}
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 64eadd5bb67e..0534f9c4547f 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -60,7 +60,7 @@
#include <com/sun/star/embed/XEncryptionProtectedStorage.hpp>
#include <com/sun/star/io/XTruncate.hpp>
#include <com/sun/star/util/XModifiable.hpp>
-#include <com/sun/star/security/XDocumentDigitalSignatures.hpp>
+#include <com/sun/star/security/DocumentDigitalSignatures.hpp>
#include <com/sun/star/xml/crypto/CipherID.hpp>
#include <com/sun/star/xml/crypto/DigestID.hpp>
@@ -1538,23 +1538,17 @@ sal_Bool SfxObjectShell::SaveTo_Impl
try
{
// get the ODF version of the new medium
- uno::Sequence< uno::Any > aArgs( 1 );
- aArgs[0] <<= ::rtl::OUString();
+ ::rtl::OUString aVersion;
try
{
uno::Reference < beans::XPropertySet > xPropSet( rMedium.GetStorage(), uno::UNO_QUERY_THROW );
- aArgs[0] = xPropSet->getPropertyValue( ::rtl::OUString( "Version" ) );
+ xPropSet->getPropertyValue( ::rtl::OUString( "Version" ) ) >>= aVersion;
}
catch( uno::Exception& )
{
}
- xDDSigns = uno::Reference< security::XDocumentDigitalSignatures >(
- comphelper::getProcessServiceFactory()->createInstanceWithArguments(
- rtl::OUString(
- "com.sun.star.security.DocumentDigitalSignatures" ),
- aArgs ),
- uno::UNO_QUERY_THROW );
+ xDDSigns = security::DocumentDigitalSignatures::createWithVersion(comphelper::getProcessComponentContext(), aVersion);
::rtl::OUString aScriptSignName = xDDSigns->getScriptingContentSignatureDefaultStreamName();
diff --git a/uui/source/secmacrowarnings.cxx b/uui/source/secmacrowarnings.cxx
index 14e5c3d199e0..12ff096200fc 100644
--- a/uui/source/secmacrowarnings.cxx
+++ b/uui/source/secmacrowarnings.cxx
@@ -19,7 +19,7 @@
#include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/security/XDocumentDigitalSignatures.hpp>
+#include <com/sun/star/security/DocumentDigitalSignatures.hpp>
#include <comphelper/sequence.hxx>
#include "comphelper/documentconstants.hxx"
#include <comphelper/processfactory.hxx>
@@ -116,7 +116,7 @@ IMPL_LINK_NOARG(MacroWarning, ViewSignsBtnHdl)
uno::Sequence< uno::Any > aArgs( 1 );
aArgs[0] = uno::makeAny( maODFVersion );
uno::Reference< security::XDocumentDigitalSignatures > xD(
- comphelper::getProcessServiceFactory()->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.security.DocumentDigitalSignatures" ) ), aArgs ), uno::UNO_QUERY );
+ security::DocumentDigitalSignatures::createDefault(comphelper::getProcessComponentContext()) );
if( xD.is() )
{
if( mxCert.is() )
@@ -135,19 +135,16 @@ IMPL_LINK_NOARG(MacroWarning, EnableBtnHdl)
uno::Sequence< uno::Any > aArgs( 1 );
aArgs[0] = uno::makeAny( maODFVersion );
uno::Reference< security::XDocumentDigitalSignatures > xD(
- comphelper::getProcessServiceFactory()->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.security.DocumentDigitalSignatures" ) ), aArgs ), uno::UNO_QUERY );
- if( xD.is() )
+ security::DocumentDigitalSignatures::createDefault(comphelper::getProcessComponentContext()) );
+ if( mxCert.is() )
+ xD->addAuthorToTrustedSources( mxCert );
+ else if( mxStore.is() )
{
- if( mxCert.is() )
- xD->addAuthorToTrustedSources( mxCert );
- else if( mxStore.is() )
- {
- DBG_ASSERT( mpInfos, "-MacroWarning::EnableBtnHdl(): no infos, search in nirvana..." );
-
- sal_Int32 nCnt = mpInfos->getLength();
- for( sal_Int32 i = 0 ; i < nCnt ; ++i )
- xD->addAuthorToTrustedSources( (*mpInfos)[ i ].Signer );
- }
+ DBG_ASSERT( mpInfos, "-MacroWarning::EnableBtnHdl(): no infos, search in nirvana..." );
+
+ sal_Int32 nCnt = mpInfos->getLength();
+ for( sal_Int32 i = 0 ; i < nCnt ; ++i )
+ xD->addAuthorToTrustedSources( (*mpInfos)[ i ].Signer );
}
}
diff --git a/uui/source/sslwarndlg.cxx b/uui/source/sslwarndlg.cxx
index 172b11df91f6..eba78e197b47 100644
--- a/uui/source/sslwarndlg.cxx
+++ b/uui/source/sslwarndlg.cxx
@@ -23,7 +23,8 @@
#include <sslwarndlg.hrc>
#include <sslwarndlg.hxx>
-#include <com/sun/star/security/XDocumentDigitalSignatures.hpp>
+#include <comphelper/componentcontext.hxx>
+#include <com/sun/star/security/DocumentDigitalSignatures.hpp>
// -----------------------------------------------------------------------
@@ -39,8 +40,7 @@ IMPL_LINK_NOARG(SSLWarnDialog, ViewCertHdl_Impl)
{
uno::Reference< ::com::sun::star::security::XDocumentDigitalSignatures > xDocumentDigitalSignatures;
- xDocumentDigitalSignatures = uno::Reference< ::com::sun::star::security::XDocumentDigitalSignatures >(
- getServiceFactory().get()->createInstance( rtl::OUString( "com.sun.star.security.DocumentDigitalSignatures" )), uno::UNO_QUERY );
+ xDocumentDigitalSignatures = ::com::sun::star::security::DocumentDigitalSignatures::createDefault( comphelper::ComponentContext(getServiceFactory()).getUNOContext() );
xDocumentDigitalSignatures.get()->showCertificate(getCert());
diff --git a/uui/source/unknownauthdlg.cxx b/uui/source/unknownauthdlg.cxx
index 17f1464a1e07..c53e5bb8d0bf 100644
--- a/uui/source/unknownauthdlg.cxx
+++ b/uui/source/unknownauthdlg.cxx
@@ -22,8 +22,9 @@
#include <ids.hrc>
#include <unknownauthdlg.hrc>
#include <unknownauthdlg.hxx>
+#include <comphelper/componentcontext.hxx>
-#include <com/sun/star/security/XDocumentDigitalSignatures.hpp>
+#include <com/sun/star/security/DocumentDigitalSignatures.hpp>
// -----------------------------------------------------------------------
@@ -47,7 +48,7 @@ IMPL_LINK_NOARG(UnknownAuthDialog, ViewCertHdl_Impl)
uno::Reference< ::com::sun::star::security::XDocumentDigitalSignatures > xDocumentDigitalSignatures;
xDocumentDigitalSignatures = uno::Reference< ::com::sun::star::security::XDocumentDigitalSignatures >(
- getServiceFactory().get()->createInstance( rtl::OUString( "com.sun.star.security.DocumentDigitalSignatures" )), uno::UNO_QUERY );
+ ::com::sun::star::security::DocumentDigitalSignatures::createDefault(comphelper::ComponentContext(getServiceFactory()).getUNOContext()) );
xDocumentDigitalSignatures.get()->showCertificate(getCert());
diff --git a/xmlsecurity/workben/signaturetest.cxx b/xmlsecurity/workben/signaturetest.cxx
index 2fbce795bf65..e5e3ac52ff31 100644
--- a/xmlsecurity/workben/signaturetest.cxx
+++ b/xmlsecurity/workben/signaturetest.cxx
@@ -51,7 +51,7 @@
#include <xmlsecurity/certificatechooser.hxx>
#include <xmlsecurity/biginteger.hxx>
-#include <com/sun/star/security/XDocumentDigitalSignatures.hpp>
+#include <com/sun/star/security/DocumentDigitalSignatures.hpp>
using namespace ::com::sun::star;
using namespace ::com::sun::star;
@@ -304,9 +304,8 @@ IMPL_LINK_NOARG(MyWin, DigitalSignaturesWithServiceHdl)
aDocFileName, embed::ElementModes::READWRITE, comphelper::getProcessServiceFactory() );
uno::Reference< security::XDocumentDigitalSignatures > xD(
- comphelper::getProcessServiceFactory()->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.security.DocumentDigitalSignatures" ) ) ), uno::UNO_QUERY );
- if ( xD.is() )
- xD->signDocumentContent( xStore, NULL );
+ security::DocumentDigitalSignatures::create(comphelper::getProcessComponentContext() );
+ xD->signDocumentContent( xStore, NULL );
return 0;
@@ -319,26 +318,21 @@ IMPL_LINK_NOARG(MyWin, VerifyDigitalSignaturesHdl)
aDocFileName, embed::ElementModes::READWRITE, comphelper::getProcessServiceFactory() );
uno::Reference< security::XDocumentDigitalSignatures > xD(
- comphelper::getProcessServiceFactory()->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.security.DocumentDigitalSignatures" ) ) ), uno::UNO_QUERY );
- if ( xD.is() )
+ security::DocumentDigitalSignatures::create(comphelper::getProcessComponentContext()) );
+ uno::Sequence< security::DocumentSignatureInformation > aInfos = xD->verifyDocumentContentSignatures( xStore, NULL );
+ int nInfos = aInfos.getLength();
+ for ( int n = 0; n < nInfos; n++ )
{
- uno::Sequence< security::DocumentSignatureInformation > aInfos = xD->verifyDocumentContentSignatures( xStore, NULL );
- int nInfos = aInfos.getLength();
- for ( int n = 0; n < nInfos; n++ )
- {
- security::DocumentSignatureInformation& rInf = aInfos[n];
- String aText( RTL_CONSTASCII_USTRINGPARAM( "The document is signed by\n\n " ) );
- aText += String( rInf.Signer->getSubjectName() );
- aText += String( RTL_CONSTASCII_USTRINGPARAM( "\n\n The signature is " ) );
- if ( !rInf.SignatureIsValid )
- aText += String( RTL_CONSTASCII_USTRINGPARAM( "NOT " ) );
- aText += String( RTL_CONSTASCII_USTRINGPARAM( "valid" ) );
- InfoBox( this, aText ).Execute();
- }
-
+ security::DocumentSignatureInformation& rInf = aInfos[n];
+ String aText( RTL_CONSTASCII_USTRINGPARAM( "The document is signed by\n\n " ) );
+ aText += String( rInf.Signer->getSubjectName() );
+ aText += String( RTL_CONSTASCII_USTRINGPARAM( "\n\n The signature is " ) );
+ if ( !rInf.SignatureIsValid )
+ aText += String( RTL_CONSTASCII_USTRINGPARAM( "NOT " ) );
+ aText += String( RTL_CONSTASCII_USTRINGPARAM( "valid" ) );
+ InfoBox( this, aText ).Execute();
}
-
return 0;
}