diff options
author | Michael Stahl <mstahl@redhat.com> | 2016-08-08 15:03:54 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2016-08-15 10:31:38 +0200 |
commit | da0c6b57e1f0081415582abc21675158c1f46c87 (patch) | |
tree | 5714ee81504b2972e7d89241aeb9845cab0b1480 /package | |
parent | 191c13b4b752a6c15cbcf9feb50646bf6d7b413c (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>
(cherry picked from commit a040c39bb6be83f47449320eb4cc185458e2cc79)
Diffstat (limited to 'package')
-rw-r--r-- | package/source/manifest/ManifestDefines.hxx | 4 | ||||
-rw-r--r-- | package/source/manifest/ManifestExport.cxx | 4 | ||||
-rw-r--r-- | package/source/manifest/ManifestImport.cxx | 3 | ||||
-rw-r--r-- | package/source/manifest/ManifestImport.hxx | 1 |
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; |