summaryrefslogtreecommitdiff
path: root/xmlsecurity
diff options
context:
space:
mode:
authorRĂ¼diger Timm <rt@openoffice.org>2005-05-18 08:56:59 +0000
committerRĂ¼diger Timm <rt@openoffice.org>2005-05-18 08:56:59 +0000
commit739ee68b65f2e3203944a699f458c0a89668302f (patch)
tree3162df336749191e59ea2c6ec172fa562ef677fa /xmlsecurity
parent1f531881de1b94425a177cba0cc627abb6b1f315 (diff)
INTEGRATION: CWS xmlsec12 (1.20.2); FILE MERGED
2005/05/02 10:39:12 mt 1.20.2.1: small performance optimization - check for signature stream before initializing the security environment
Diffstat (limited to 'xmlsecurity')
-rw-r--r--xmlsecurity/source/component/documentdigitalsignatures.cxx38
1 files changed, 19 insertions, 19 deletions
diff --git a/xmlsecurity/source/component/documentdigitalsignatures.cxx b/xmlsecurity/source/component/documentdigitalsignatures.cxx
index 9db49ba87b76..2a8809ac7604 100644
--- a/xmlsecurity/source/component/documentdigitalsignatures.cxx
+++ b/xmlsecurity/source/component/documentdigitalsignatures.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: documentdigitalsignatures.cxx,v $
*
- * $Revision: 1.20 $
+ * $Revision: 1.21 $
*
- * last change: $Author: hr $ $Date: 2005-04-08 16:19:50 $
+ * last change: $Author: rt $ $Date: 2005-05-18 09:56:59 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -203,6 +203,21 @@ sal_Bool DocumentDigitalSignatures::ImplViewSignatures( const Reference< ::com::
Sequence< ::com::sun::star::security::DocumentSignaturesInformation > DocumentDigitalSignatures::ImplVerifySignatures( const Reference< ::com::sun::star::embed::XStorage >& rxStorage, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xSignStream, DocumentSignatureMode eMode ) throw (RuntimeException)
{
+ // First check for the InputStream, to avoid unnecessary initialization of the security environemnt...
+ SignatureStreamHelper aStreamHelper;
+ Reference< io::XInputStream > xInputStream = xSignStream;
+
+ if ( !xInputStream.is() )
+ {
+ aStreamHelper = DocumentSignatureHelper::OpenSignatureStream( rxStorage, embed::ElementModes::READ, eMode );
+ if ( aStreamHelper.xSignatureStream.is() )
+ xInputStream = Reference< io::XInputStream >( aStreamHelper.xSignatureStream, UNO_QUERY );
+ }
+
+ if ( !xInputStream.is() )
+ return Sequence< ::com::sun::star::security::DocumentSignaturesInformation >(0);
+
+
XMLSignatureHelper aSignatureHelper( mxMSF );
bool bInit = aSignatureHelper.Init( rtl::OUString() );
@@ -210,28 +225,13 @@ Sequence< ::com::sun::star::security::DocumentSignaturesInformation > DocumentDi
DBG_ASSERT( bInit, "Error initializing security context!" );
if ( !bInit )
- {
- Sequence< ::com::sun::star::security::DocumentSignaturesInformation > aInfos(0);
- return aInfos;
- }
+ return Sequence< ::com::sun::star::security::DocumentSignaturesInformation >(0);
aSignatureHelper.SetStorage( rxStorage );
aSignatureHelper.StartMission();
- SignatureStreamHelper aStreamHelper;
- Reference< io::XInputStream > xInputStream = xSignStream;
-
- if ( !xInputStream.is() )
- {
- aStreamHelper = DocumentSignatureHelper::OpenSignatureStream( rxStorage, embed::ElementModes::READ, eMode );
- if ( aStreamHelper.xSignatureStream.is() )
- xInputStream = Reference< io::XInputStream >( aStreamHelper.xSignatureStream, UNO_QUERY );
- }
-
- if ( xInputStream.is() )
- aSignatureHelper.ReadAndVerifySignature( xInputStream );
-
+ aSignatureHelper.ReadAndVerifySignature( xInputStream );
aSignatureHelper.EndMission();