summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2016-08-08 15:03:54 +0200
committerCaolán McNamara <caolanm@redhat.com>2016-08-09 20:49:41 +0000
commita040c39bb6be83f47449320eb4cc185458e2cc79 (patch)
tree21aa71e53b973995fe138c81b7a6b08973058b51
parentd89abe0806947149eafbd9d7ce4b3095ec38b236 (diff)
OFFICE-3708: package: recognize correct SHA256 URL
ODF 1.2 uses an incorrect URL to refer to SHA256, add support for the correct W3C URL on import but continue to export the incorrect URL for now. Change-Id: I3135bcf989070d20f85f14702db07595f304e706 (cherry picked from commit 1015d35f2362953f415804476037d4f162eb49b5) Reviewed-on: https://gerrit.libreoffice.org/28008 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--package/source/manifest/ManifestDefines.hxx4
-rw-r--r--package/source/manifest/ManifestExport.cxx4
-rw-r--r--package/source/manifest/ManifestImport.cxx3
-rw-r--r--package/source/manifest/ManifestImport.hxx1
4 files changed, 9 insertions, 3 deletions
diff --git a/package/source/manifest/ManifestDefines.hxx b/package/source/manifest/ManifestDefines.hxx
index 3db4a0b584bc..968aed648e6a 100644
--- a/package/source/manifest/ManifestDefines.hxx
+++ b/package/source/manifest/ManifestDefines.hxx
@@ -52,7 +52,9 @@
#define ATTRIBUTE_SALT "manifest:salt"
#define ATTRIBUTE_ITERATION_COUNT "manifest:iteration-count"
-#define SHA256_URL "http://www.w3.org/2000/09/xmldsig#sha256"
+/// OFFICE-3708: wrong URL cited in ODF 1.2 and used since OOo 3.4 beta
+#define SHA256_URL_ODF12 "http://www.w3.org/2000/09/xmldsig#sha256"
+#define SHA256_URL "http://www.w3.org/2001/04/xmlenc#sha256"
#define SHA1_NAME "SHA1"
#define SHA1_URL "http://www.w3.org/2000/09/xmldsig#sha1"
diff --git a/package/source/manifest/ManifestExport.cxx b/package/source/manifest/ManifestExport.cxx
index 2c12b5f574d1..ebb87f6d47d9 100644
--- a/package/source/manifest/ManifestExport.cxx
+++ b/package/source/manifest/ManifestExport.cxx
@@ -81,6 +81,7 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > xHa
const OUString sWhiteSpace ( " " );
+ const OUString sSHA256_URL_ODF12 ( SHA256_URL_ODF12 );
const OUString sSHA256_URL ( SHA256_URL );
const OUString sSHA1_Name ( SHA1_NAME );
@@ -350,7 +351,8 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > xHa
*pStartKeyAlg >>= nStartKeyAlgID;
if ( nStartKeyAlgID == xml::crypto::DigestID::SHA256 )
{
- sStartKeyAlg = sSHA256_URL;
+ sStartKeyAlg = sSHA256_URL_ODF12; // TODO use sSHA256_URL
+ (void) sSHA256_URL;
aBuffer.append( (sal_Int32)32 );
sStartKeySize = aBuffer.makeStringAndClear();
}
diff --git a/package/source/manifest/ManifestImport.cxx b/package/source/manifest/ManifestImport.cxx
index 7cc28660d783..0bf9819d2a1e 100644
--- a/package/source/manifest/ManifestImport.cxx
+++ b/package/source/manifest/ManifestImport.cxx
@@ -70,6 +70,7 @@ ManifestImport::ManifestImport( vector < Sequence < PropertyValue > > & rNewManV
, sStartKeyAlgProperty ( "StartKeyAlgorithm" )
, sDigestAlgProperty ( "DigestAlgorithm" )
+ , sSHA256_URL_ODF12 ( SHA256_URL_ODF12 )
, sSHA256_URL ( SHA256_URL )
, sSHA1_Name ( SHA1_NAME )
, sSHA1_URL ( SHA1_URL )
@@ -228,7 +229,7 @@ void ManifestImport::doStartKeyAlg(StringHashMap &rConvertedAttribs)
throw( uno::RuntimeException )
{
OUString aString = rConvertedAttribs[sStartKeyAlgNameAttribute];
- if ( aString.equals( sSHA256_URL ) ) {
+ if (aString.equals(sSHA256_URL) || aString.equals(sSHA256_URL_ODF12)) {
aSequence[PKG_MNFST_STARTALG].Name = sStartKeyAlgProperty;
aSequence[PKG_MNFST_STARTALG].Value <<= xml::crypto::DigestID::SHA256;
} else if ( aString.equals( sSHA1_Name ) || aString.equals( sSHA1_URL ) ) {
diff --git a/package/source/manifest/ManifestImport.hxx b/package/source/manifest/ManifestImport.hxx
index 19484969cb75..4e25499f5629 100644
--- a/package/source/manifest/ManifestImport.hxx
+++ b/package/source/manifest/ManifestImport.hxx
@@ -93,6 +93,7 @@ protected:
const OUString sStartKeyAlgProperty;
const OUString sDigestAlgProperty;
+ const OUString sSHA256_URL_ODF12;
const OUString sSHA256_URL;
const OUString sSHA1_Name;
const OUString sSHA1_URL;