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
This commit is contained in:
@@ -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,22 +203,7 @@ 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)
|
||||
{
|
||||
XMLSignatureHelper aSignatureHelper( mxMSF );
|
||||
|
||||
bool bInit = aSignatureHelper.Init( rtl::OUString() );
|
||||
|
||||
DBG_ASSERT( bInit, "Error initializing security context!" );
|
||||
|
||||
if ( !bInit )
|
||||
{
|
||||
Sequence< ::com::sun::star::security::DocumentSignaturesInformation > aInfos(0);
|
||||
return aInfos;
|
||||
}
|
||||
|
||||
aSignatureHelper.SetStorage( rxStorage );
|
||||
|
||||
aSignatureHelper.StartMission();
|
||||
|
||||
// First check for the InputStream, to avoid unnecessary initialization of the security environemnt...
|
||||
SignatureStreamHelper aStreamHelper;
|
||||
Reference< io::XInputStream > xInputStream = xSignStream;
|
||||
|
||||
@@ -229,10 +214,25 @@ Sequence< ::com::sun::star::security::DocumentSignaturesInformation > DocumentDi
|
||||
xInputStream = Reference< io::XInputStream >( aStreamHelper.xSignatureStream, UNO_QUERY );
|
||||
}
|
||||
|
||||
if ( xInputStream.is() )
|
||||
aSignatureHelper.ReadAndVerifySignature( xInputStream );
|
||||
if ( !xInputStream.is() )
|
||||
return Sequence< ::com::sun::star::security::DocumentSignaturesInformation >(0);
|
||||
|
||||
|
||||
XMLSignatureHelper aSignatureHelper( mxMSF );
|
||||
|
||||
bool bInit = aSignatureHelper.Init( rtl::OUString() );
|
||||
|
||||
DBG_ASSERT( bInit, "Error initializing security context!" );
|
||||
|
||||
if ( !bInit )
|
||||
return Sequence< ::com::sun::star::security::DocumentSignaturesInformation >(0);
|
||||
|
||||
aSignatureHelper.SetStorage( rxStorage );
|
||||
|
||||
aSignatureHelper.StartMission();
|
||||
|
||||
aSignatureHelper.ReadAndVerifySignature( xInputStream );
|
||||
|
||||
aSignatureHelper.EndMission();
|
||||
|
||||
Reference< ::com::sun::star::xml::crypto::XSecurityEnvironment > xSecEnv = aSignatureHelper.GetSecurityEnvironment();
|
||||
|
Reference in New Issue
Block a user