summaryrefslogtreecommitdiff
path: root/package
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2016-08-08 15:03:54 +0200
committerMichael Stahl <mstahl@redhat.com>2016-08-08 15:19:11 +0200
commit1015d35f2362953f415804476037d4f162eb49b5 (patch)
tree5e134936e99d2ec95ab3177695b465821386c83e /package
parent602647c2417e0e19e44f9c35a49fbb88ff8ac261 (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
Diffstat (limited to 'package')
-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 10b30fb5910e..60bcb8b3ff2a 100644
--- a/package/source/manifest/ManifestExport.cxx
+++ b/package/source/manifest/ManifestExport.cxx
@@ -81,6 +81,7 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con
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 > con
*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 69d5a33a8873..1b171bc6ffe3 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;