diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2017-06-26 12:32:48 +0200 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2017-06-27 09:25:32 +0200 |
commit | e2378bbf4539455e445205ad868c43246ec423ed (patch) | |
tree | ae512eae3b33b05ada35e06f1a65237cb4b7b3d9 /xmlsecurity/source/helper/documentsignaturehelper.cxx | |
parent | 9674704cb721f600d678788aa5d9392ad410c330 (diff) |
tdf#108711 GPG key selection should only be possible for ODF >= 1.2 documents
gpg4libre
Change-Id: I6dbdaefddacf55c9381d156ada20cb3f25d4b3cb
Reviewed-on: https://gerrit.libreoffice.org/39263
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'xmlsecurity/source/helper/documentsignaturehelper.cxx')
-rw-r--r-- | xmlsecurity/source/helper/documentsignaturehelper.cxx | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/xmlsecurity/source/helper/documentsignaturehelper.cxx b/xmlsecurity/source/helper/documentsignaturehelper.cxx index 618b69445222..161f36e4ed66 100644 --- a/xmlsecurity/source/helper/documentsignaturehelper.cxx +++ b/xmlsecurity/source/helper/documentsignaturehelper.cxx @@ -403,6 +403,25 @@ SignatureStreamHelper DocumentSignatureHelper::OpenSignatureStream( return aHelper; } +/** Check whether the current file can be signed with GPG (only ODF >= 1.2 can currently) */ +bool DocumentSignatureHelper::CanSignWithGPG( + const Reference < css::embed::XStorage >& rxStore, + const OUString& sOdfVersion) +{ + uno::Reference<container::XNameAccess> xNameAccess(rxStore, uno::UNO_QUERY); + if (!xNameAccess.is()) + throw RuntimeException(); + + if (xNameAccess->hasByName("META-INF")) // ODF + { + return !isODFPre_1_2(sOdfVersion); + } + + return false; +} + + + //sElementList contains all files which are expected to be signed. Only those files must me signed, //no more, no less. //The DocumentSignatureAlgorithm indicates if the document was created with OOo 2.x. Then |