diff options
Diffstat (limited to 'xmlsecurity/source/helper/documentsignaturehelper.cxx')
-rw-r--r-- | xmlsecurity/source/helper/documentsignaturehelper.cxx | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/xmlsecurity/source/helper/documentsignaturehelper.cxx b/xmlsecurity/source/helper/documentsignaturehelper.cxx index 08a4f0b48e8b..fd916c651a4e 100644 --- a/xmlsecurity/source/helper/documentsignaturehelper.cxx +++ b/xmlsecurity/source/helper/documentsignaturehelper.cxx @@ -32,6 +32,7 @@ #include <osl/diagnose.h> #include <rtl/uri.hxx> +using namespace ::com::sun::star; using namespace ::com::sun::star::uno; namespace @@ -300,27 +301,34 @@ SignatureStreamHelper DocumentSignatureHelper::OpenSignatureStream( SignatureStreamHelper aHelper; - try + uno::Reference<container::XNameAccess> xNameAccess(rxStore, uno::UNO_QUERY); + if (!xNameAccess.is()) + return aHelper; + + if (xNameAccess->hasByName("META-INF")) { - OUString aSIGStoreName( "META-INF" ); - aHelper.xSignatureStorage = rxStore->openStorageElement( aSIGStoreName, nSubStorageOpenMode ); - if ( aHelper.xSignatureStorage.is() ) + try { - OUString aSIGStreamName; - if ( eDocSigMode == SignatureModeDocumentContent ) - aSIGStreamName = DocumentSignatureHelper::GetDocumentContentSignatureDefaultStreamName(); - else if ( eDocSigMode == SignatureModeMacros ) - aSIGStreamName = DocumentSignatureHelper::GetScriptingContentSignatureDefaultStreamName(); - else - aSIGStreamName = DocumentSignatureHelper::GetPackageSignatureDefaultStreamName(); - - aHelper.xSignatureStream = aHelper.xSignatureStorage->openStreamElement( aSIGStreamName, nOpenMode ); + OUString aSIGStoreName( "META-INF" ); + aHelper.xSignatureStorage = rxStore->openStorageElement( aSIGStoreName, nSubStorageOpenMode ); + if ( aHelper.xSignatureStorage.is() ) + { + OUString aSIGStreamName; + if ( eDocSigMode == SignatureModeDocumentContent ) + aSIGStreamName = DocumentSignatureHelper::GetDocumentContentSignatureDefaultStreamName(); + else if ( eDocSigMode == SignatureModeMacros ) + aSIGStreamName = DocumentSignatureHelper::GetScriptingContentSignatureDefaultStreamName(); + else + aSIGStreamName = DocumentSignatureHelper::GetPackageSignatureDefaultStreamName(); + + aHelper.xSignatureStream = aHelper.xSignatureStorage->openStreamElement( aSIGStreamName, nOpenMode ); + } + } + catch(css::io::IOException& ) + { + // Doesn't have to exist... + DBG_ASSERT( nOpenMode == css::embed::ElementModes::READ, "Error creating signature stream..." ); } - } - catch(css::io::IOException& ) - { - // Doesn't have to exist... - DBG_ASSERT( nOpenMode == css::embed::ElementModes::READ, "Error creating signature stream..." ); } return aHelper; |