diff options
Diffstat (limited to 'xmlsecurity/source/helper/xmlsignaturehelper.cxx')
-rw-r--r-- | xmlsecurity/source/helper/xmlsignaturehelper.cxx | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/xmlsecurity/source/helper/xmlsignaturehelper.cxx b/xmlsecurity/source/helper/xmlsignaturehelper.cxx index 18fb74c6c399..b46d8ba194cb 100644 --- a/xmlsecurity/source/helper/xmlsignaturehelper.cxx +++ b/xmlsecurity/source/helper/xmlsignaturehelper.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -53,8 +53,8 @@ /* SEInitializer component */ #define SEINITIALIZER_COMPONENT "com.sun.star.xml.crypto.SEInitializer" -#define TAG_DOCUMENTSIGNATURES "document-signatures" -#define NS_DOCUMENTSIGNATURES "http://openoffice.org/2004/documentsignatures" +#define TAG_DOCUMENTSIGNATURES "document-signatures" +#define NS_DOCUMENTSIGNATURES "http://openoffice.org/2004/documentsignatures" #define NS_DOCUMENTSIGNATURES_ODF_1_2 "urn:oasis:names:tc:opendocument:xmlns:digitalsignature:1.0" using namespace ::com::sun::star; @@ -80,7 +80,7 @@ bool XMLSignatureHelper::Init( const rtl::OUString& rTokenPath ) DBG_ASSERT( !mxSecurityContext.is(), "XMLSignatureHelper::Init - mxSecurityContext already set!" ); ImplCreateSEInitializer(); - + if ( mxSEInitializer.is() ) mxSecurityContext = mxSEInitializer->createSecurityContext( rTokenPath ); @@ -88,7 +88,7 @@ bool XMLSignatureHelper::Init( const rtl::OUString& rTokenPath ) } void XMLSignatureHelper::ImplCreateSEInitializer() -{ +{ rtl::OUString sSEInitializer(rtl::OUString::createFromAscii( SEINITIALIZER_COMPONENT )); uno::Reference< lang::XMultiComponentFactory > xMCF( mxCtx->getServiceManager() ); mxSEInitializer = uno::Reference< com::sun::star::xml::crypto::XSEInitializer > ( @@ -105,7 +105,7 @@ com::sun::star::uno::Reference< com::sun::star::xml::crypto::XUriBinding > XMLSi return mxUriBinding; } -void XMLSignatureHelper::SetStorage( +void XMLSignatureHelper::SetStorage( const Reference < css::embed::XStorage >& rxStorage, ::rtl::OUString sODFVersion) { @@ -140,7 +140,7 @@ sal_Int32 XMLSignatureHelper::GetNewSecurityId() return mpXSecController->getNewSecurityId(); } -void XMLSignatureHelper::SetX509Certificate( +void XMLSignatureHelper::SetX509Certificate( sal_Int32 nSecurityId, const rtl::OUString& ouX509IssuerName, const rtl::OUString& ouX509SerialNumber, @@ -153,7 +153,7 @@ void XMLSignatureHelper::SetX509Certificate( ouX509Cert); } -void XMLSignatureHelper::SetX509Certificate( +void XMLSignatureHelper::SetX509Certificate( sal_Int32 nSecurityId, sal_Int32 nSecurityEnvironmentIndex, const rtl::OUString& ouX509IssuerName, @@ -196,31 +196,31 @@ uno::Reference<xml::sax::XDocumentHandler> XMLSignatureHelper::CreateDocumentHan const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& xOutputStream ) { /* - * get SAX writer component + * get SAX writer component */ uno::Reference< lang::XMultiComponentFactory > xMCF( mxCtx->getServiceManager() ); uno::Reference< io::XActiveDataSource > xSaxWriter( - xMCF->createInstanceWithContext(rtl::OUString::createFromAscii( + xMCF->createInstanceWithContext(rtl::OUString::createFromAscii( "com.sun.star.xml.sax.Writer"), mxCtx ), uno::UNO_QUERY ); - + DBG_ASSERT( xSaxWriter.is(), "can't instantiate XML writer" ); - + /* - * connect XML writer to output stream + * connect XML writer to output stream */ xSaxWriter->setOutputStream( xOutputStream ); /* * prepare document handler */ - uno::Reference<xml::sax::XDocumentHandler> + uno::Reference<xml::sax::XDocumentHandler> xDocHandler( xSaxWriter,uno::UNO_QUERY); - + /* * write the xml context for signatures */ rtl::OUString tag_AllSignatures(RTL_CONSTASCII_USTRINGPARAM(TAG_DOCUMENTSIGNATURES)); - + SvXMLAttributeList *pAttributeList = new SvXMLAttributeList(); rtl::OUString sNamespace; if (mbODFPre1_2) @@ -231,12 +231,12 @@ uno::Reference<xml::sax::XDocumentHandler> XMLSignatureHelper::CreateDocumentHan pAttributeList->AddAttribute( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ATTR_XMLNS)), sNamespace); - + xDocHandler->startDocument(); - xDocHandler->startElement( + xDocHandler->startElement( tag_AllSignatures, uno::Reference< com::sun::star::xml::sax::XAttributeList > (pAttributeList)); - + return xDocHandler; } @@ -247,7 +247,7 @@ void XMLSignatureHelper::CloseDocumentHandler( const uno::Reference<xml::sax::XD xDocumentHandler->endDocument(); } -void XMLSignatureHelper::ExportSignature( +void XMLSignatureHelper::ExportSignature( const uno::Reference< xml::sax::XDocumentHandler >& xDocumentHandler, const SignatureInformation& signatureInfo ) { @@ -262,7 +262,7 @@ bool XMLSignatureHelper::CreateAndWriteSignature( const uno::Reference< xml::sax * create a signature listener */ /* - ImplXMLSignatureListener* pSignatureListener = new ImplXMLSignatureListener( + ImplXMLSignatureListener* pSignatureListener = new ImplXMLSignatureListener( LINK( this, XMLSignatureHelper, SignatureCreationResultListener ), LINK( this, XMLSignatureHelper, SignatureVerifyResultListener ), LINK( this, XMLSignatureHelper, StartVerifySignatureElement ) ); @@ -284,30 +284,30 @@ bool XMLSignatureHelper::CreateAndWriteSignature( const uno::Reference< xml::sax * clear up the signature creation listener */ //mpXSecController->setSignatureCreationResultListener( NULL ); - + return !mbError; } bool XMLSignatureHelper::CreateAndWriteSignature( const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& xOutputStream ) { - uno::Reference<xml::sax::XDocumentHandler> xDocHandler + uno::Reference<xml::sax::XDocumentHandler> xDocHandler = CreateDocumentHandlerWithHeader(xOutputStream); - + bool rc = CreateAndWriteSignature( xDocHandler ); - + CloseDocumentHandler(xDocHandler); - + return rc; } bool XMLSignatureHelper::ReadAndVerifySignature( const com::sun::star::uno::Reference< com::sun::star::io::XInputStream >& xInputStream ) { mbError = false; - + DBG_ASSERT(xInputStream.is(), "input stream missing"); - + /* - * prepare ParserInputSrouce + * prepare ParserInputSrouce */ xml::sax::InputSource aParserInput; // aParserInput.sSystemId = ouName; @@ -327,31 +327,31 @@ bool XMLSignatureHelper::ReadAndVerifySignature( const com::sun::star::uno::Refe /* * create a signature reader */ - uno::Reference< xml::sax::XDocumentHandler > xHandler + uno::Reference< xml::sax::XDocumentHandler > xHandler = mpXSecController->createSignatureReader( ); - + /* * create a signature listener */ - ImplXMLSignatureListener* pSignatureListener = new ImplXMLSignatureListener( + ImplXMLSignatureListener* pSignatureListener = new ImplXMLSignatureListener( LINK( this, XMLSignatureHelper, SignatureCreationResultListener ), LINK( this, XMLSignatureHelper, SignatureVerifyResultListener ), LINK( this, XMLSignatureHelper, StartVerifySignatureElement ) ); - + /* * configure the signature verify listener */ //mpXSecController->setSignatureVerifyResultListener( pSignatureListener ); - + /* * setup the connection: * Parser -> SignatureListener -> SignatureReader */ - pSignatureListener->setNextHandler(xHandler); + pSignatureListener->setNextHandler(xHandler); xParser->setDocumentHandler( pSignatureListener ); - + /* - * parser the stream + * parser the stream */ try { @@ -373,11 +373,11 @@ bool XMLSignatureHelper::ReadAndVerifySignature( const com::sun::star::uno::Refe { mbError = true; } - + /* * clear up the connection */ - pSignatureListener->setNextHandler( NULL ); + pSignatureListener->setNextHandler( NULL ); /* * clear up the signature verify listener @@ -388,7 +388,7 @@ bool XMLSignatureHelper::ReadAndVerifySignature( const com::sun::star::uno::Refe * release the signature reader */ mpXSecController->releaseSignatureReader( ); - + return !mbError; } |