[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - package/source
Michael Stahl
mstahl at redhat.com
Tue Aug 9 16:04:44 UTC 2016
package/source/manifest/ManifestDefines.hxx | 4 +++-
package/source/manifest/ManifestExport.cxx | 4 +++-
package/source/manifest/ManifestImport.cxx | 3 ++-
package/source/manifest/ManifestImport.hxx | 1 +
4 files changed, 9 insertions(+), 3 deletions(-)
New commits:
commit 04bfc2ebb6c9f15184a01a7234768a4c73e26e66
Author: Michael Stahl <mstahl at redhat.com>
Date: Mon Aug 8 15:03:54 2016 +0200
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/27988
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
diff --git a/package/source/manifest/ManifestDefines.hxx b/package/source/manifest/ManifestDefines.hxx
index 3db4a0b..968aed6 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 2c12b5f..ebb87f6 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 69d5a33..1b171bc 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 1948496..4e25499 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;
More information about the Libreoffice-commits
mailing list