[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-1+backports' - package/source xmlsecurity/qa

Michael Stahl (via logerrit) logerrit at kemper.freedesktop.org
Wed Jul 22 10:39:34 UTC 2020


 package/source/manifest/ManifestImport.cxx              |   31 +++++++++-------
 xmlsecurity/qa/unit/signing/data/encryptedGPG_odf13.odt |binary
 2 files changed, 18 insertions(+), 13 deletions(-)

New commits:
commit 28fa593dd8a0bab4045f404e4a9df96b68026798
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri May 15 15:12:23 2020 +0200
Commit:     Michael Stahl <michael.stahl at cib.de>
CommitDate: Wed Jul 22 12:39:01 2020 +0200

    package: OFFICE-3940 ODF 1.3 import of OpenPGP encryption
    
    This was supposed to be implemented by commit
    a7bf6488ebb544e1efaed0a1e53073df9cc2064d
    "ODF1.3: import new OpenPGP encryption markup"
    but it turns out that the ODF 1.3 cs01 schema differs from the
    implementation:
    
    in ODF 1.3 cs01 we have
    
     <manifest:encrypted-key>
      <manifest:encryption-method .../>
      <manifest:keyinfo>
        <manifest:PGPData>
        </manifest:PGPData>
      </manifest:keyinfo>
      <manifest:CipherData>
      </manifest:CipherData>
     </manifest:encrypted-key>
    
    whereas the implementation expects
    
     <manifest:keyinfo>
      <manifest:encrypted-key>
       <manifest:encryption-method .../>
        <manifest:PGPData>
        </manifest:PGPData>
       <manifest:CipherData>
       </manifest:CipherData>
      </manifest:encrypted-key>
     </manifest:keyinfo>
    
    Ideally the inner manifest:keyinfo should be manifest:KeyInfo but
    not sure if that really matters.
    
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94309
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>
    (cherry picked from commit 4f1b0f7d5235140611305b784b58f95fc5b8bd81)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94586
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    (cherry picked from commit a3ef13b495d5898488ae52981bdaf8cf34db791c)
    
    Change-Id: I407321c857e7b3ed9f4d04568ca2ea116764b3da
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99155
    Tested-by: Michael Stahl <michael.stahl at cib.de>
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>

diff --git a/package/source/manifest/ManifestImport.cxx b/package/source/manifest/ManifestImport.cxx
index 9982aae75209..425f3fe3f097 100644
--- a/package/source/manifest/ManifestImport.cxx
+++ b/package/source/manifest/ManifestImport.cxx
@@ -354,8 +354,8 @@ void SAL_CALL ManifestImport::startElement( const OUString& aName, const uno::Re
             doFileEntry(aConvertedAttribs);
         else if (aConvertedName == gsManifestKeyInfoElement) //loext:keyinfo
             doKeyInfoEntry(aConvertedAttribs);
-        else if (aConvertedName == gsManifestKeyInfoElement13) //manifest:keyinfo
-            doKeyInfoEntry(aConvertedAttribs);
+        else if (aConvertedName == gsEncryptedKeyElement13)   //manifest:encrypted-key
+            doEncryptedKey(aConvertedAttribs);
         else
             aStack.back().m_bValid = false;
         break;
@@ -370,8 +370,12 @@ void SAL_CALL ManifestImport::startElement( const OUString& aName, const uno::Re
             doEncryptionData(aConvertedAttribs);
         else if (aConvertedName == gsEncryptedKeyElement)   //loext:encrypted-key
             doEncryptedKey(aConvertedAttribs);
-        else if (aConvertedName == gsEncryptedKeyElement13)   //manifest:encrypted-key
-            doEncryptedKey(aConvertedAttribs);
+        else if (aConvertedName == gsEncryptionMethodElement13)   //manifest:encryption-method
+            doEncryptionMethod(aConvertedAttribs, gsAlgorithmAttribute13);
+        else if (aConvertedName == gsManifestKeyInfoElement13) //manifest:keyinfo
+            ;
+        else if (aConvertedName == gsCipherDataElement13)            //manifest:CipherData
+            ;
         else
             aStack.back().m_bValid = false;
         break;
@@ -390,16 +394,15 @@ void SAL_CALL ManifestImport::startElement( const OUString& aName, const uno::Re
             doStartKeyAlg(aConvertedAttribs);
         else if (aConvertedName == gsEncryptionMethodElement)   //loext:encryption-method
             doEncryptionMethod(aConvertedAttribs, gsAlgorithmAttribute);
-        else if (aConvertedName == gsEncryptionMethodElement13)   //manifest:encryption-method
-            doEncryptionMethod(aConvertedAttribs, gsAlgorithmAttribute13);
         else if (aConvertedName == gsKeyInfoElement)            //loext:KeyInfo
             doEncryptedKeyInfo(aConvertedAttribs);
         else if (aConvertedName == gsCipherDataElement)            //loext:CipherData
             doEncryptedCipherData(aConvertedAttribs);
-        else if (aConvertedName == gsCipherDataElement13)            //manifest:CipherData
-            doEncryptedCipherData(aConvertedAttribs);
         else if (aConvertedName == gsPgpDataElement13)   //manifest:PGPData
             doEncryptedPgpData(aConvertedAttribs);
+        else if (aConvertedName == gsCipherValueElement13) //manifest:CipherValue
+            // ciphervalue action happens on endElement
+            aCurrentCharacters = "";
         else
             aStack.back().m_bValid = false;
         break;
@@ -415,9 +418,6 @@ void SAL_CALL ManifestImport::startElement( const OUString& aName, const uno::Re
         else if (aConvertedName == gsCipherValueElement) //loext:CipherValue
             // ciphervalue action happens on endElement
             aCurrentCharacters = "";
-        else if (aConvertedName == gsCipherValueElement13) //manifest:CipherValue
-            // ciphervalue action happens on endElement
-            aCurrentCharacters = "";
         else if (aConvertedName == gsPgpKeyIDElement13)   //manifest:PGPKeyID
             // ciphervalue action happens on endElement
             aCurrentCharacters = "";
@@ -495,11 +495,16 @@ void SAL_CALL ManifestImport::endElement( const OUString& aName )
 
         // end element handling for elements with cdata
         switch (nLevel) {
+            case 4: {
+                if (aConvertedName == gsCipherValueElement13) //manifest:CipherValue
+                    doEncryptedCipherValue();
+                else
+                    aStack.back().m_bValid = false;
+                break;
+            }
             case 5: {
                 if (aConvertedName == gsCipherValueElement) //loext:CipherValue
                     doEncryptedCipherValue();
-                else if (aConvertedName == gsCipherValueElement13) //manifest:CipherValue
-                    doEncryptedCipherValue();
                 else if (aConvertedName == gsPgpKeyIDElement13)   //manifest:PGPKeyID
                     doEncryptedKeyId();
                 else if (aConvertedName == gsPGPKeyPacketElement13) //manifest:PGPKeyPacket
diff --git a/xmlsecurity/qa/unit/signing/data/encryptedGPG_odf13.odt b/xmlsecurity/qa/unit/signing/data/encryptedGPG_odf13.odt
index 6bcc43503267..e738c2f6df89 100644
Binary files a/xmlsecurity/qa/unit/signing/data/encryptedGPG_odf13.odt and b/xmlsecurity/qa/unit/signing/data/encryptedGPG_odf13.odt differ


More information about the Libreoffice-commits mailing list