xmlsecurity/qa/unit/signing/signing.cxx        |   12 ++++++------
 xmlsecurity/source/helper/ooxmlsecexporter.cxx |    7 ++++++-
 2 files changed, 12 insertions(+), 7 deletions(-)

New commits:
commit df19ac045faff757f9ba17cb5f6ac00d510d954d
Author:     Gabor Kelemen <kelemen.gab...@nisz.hu>
AuthorDate: Tue Nov 9 18:09:47 2021 +0100
Commit:     Gabor Kelemen <kelemen.gab...@nisz.hu>
CommitDate: Tue Nov 9 18:09:47 2021 +0100

    Fix unit test break in ECDSA OOXML test
    
    Accidental regression from
    commit 7ecb0f495183a7b3da97a3b24eeba9566c41314c
    
    Change-Id: Ieff4f50d836ddcf08c2b5e63a2336cf18b533043

diff --git a/xmlsecurity/source/helper/ooxmlsecexporter.cxx 
b/xmlsecurity/source/helper/ooxmlsecexporter.cxx
index a2447cab5b80..5ac4a9e3a81d 100644
--- a/xmlsecurity/source/helper/ooxmlsecexporter.cxx
+++ b/xmlsecurity/source/helper/ooxmlsecexporter.cxx
@@ -139,7 +139,12 @@ void 
OOXMLSecExporter::Impl::writeCanonicalizationTransform()
 void OOXMLSecExporter::Impl::writeSignatureMethod()
 {
     rtl::Reference<SvXMLAttributeList> pAttributeList(new 
SvXMLAttributeList());
-    pAttributeList->AddAttribute("Algorithm", ALGO_RSASHA256);
+
+    if (m_rInformation.eAlgorithmID == 
svl::crypto::SignatureMethodAlgorithm::ECDSA)
+        pAttributeList->AddAttribute("Algorithm", ALGO_ECDSASHA256);
+    else
+        pAttributeList->AddAttribute("Algorithm", ALGO_RSASHA256);
+
     m_xDocumentHandler->startElement(
         "SignatureMethod", 
uno::Reference<xml::sax::XAttributeList>(pAttributeList.get()));
     m_xDocumentHandler->endElement("SignatureMethod");
commit 839623e12fa5c121ea9a438ab320ec328e436f32
Author:     Gabor Kelemen <kelemen.gab...@nisz.hu>
AuthorDate: Tue Nov 9 16:33:42 2021 +0100
Commit:     Gabor Kelemen <kelemen.gab...@nisz.hu>
CommitDate: Tue Nov 9 16:33:42 2021 +0100

    Revert "Temporarily comment out failing unit test"
    
    This reverts commit 2eba6e2f3878f71302ae17ee3a3fa5fac04cbc95.
    
    Better solution has been found

diff --git a/xmlsecurity/qa/unit/signing/signing.cxx 
b/xmlsecurity/qa/unit/signing/signing.cxx
index 6d894471cfeb..1853b5eead8c 100644
--- a/xmlsecurity/qa/unit/signing/signing.cxx
+++ b/xmlsecurity/qa/unit/signing/signing.cxx
@@ -79,7 +79,7 @@ public:
 
     void testDescription();
     void testECDSA();
-    //    void testECDSAOOXML();
+    void testECDSAOOXML();
     void testECDSAPDF();
     /// Test a typical ODF where all streams are signed.
     void testODFGood();
@@ -139,7 +139,7 @@ public:
     CPPUNIT_TEST_SUITE(SigningTest);
     CPPUNIT_TEST(testDescription);
     CPPUNIT_TEST(testECDSA);
-    //    CPPUNIT_TEST(testECDSAOOXML);
+    CPPUNIT_TEST(testECDSAOOXML);
     CPPUNIT_TEST(testECDSAPDF);
     CPPUNIT_TEST(testODFGood);
     CPPUNIT_TEST(testODFBroken);
@@ -377,7 +377,7 @@ void SigningTest::testECDSA()
                          rInformations[0].nStatus);
 }
 
-/*void SigningTest::testECDSAOOXML()
+void SigningTest::testECDSAOOXML()
 {
     // Create an empty document and store it to a tempfile, finally load it as 
a storage.
     createDoc("");
@@ -406,17 +406,17 @@ void SigningTest::testECDSA()
     OUString aDescription;
     sal_Int32 nSecurityId;
     aManager.add(xCertificate, mxSecurityContext, aDescription, nSecurityId,
-                 /*bAdESCompliant=false);
+                 /*bAdESCompliant=*/false);
 
     // Read back the signature and make sure that it's valid.
-    aManager.read(/*bUseTempStream=true);
+    aManager.read(/*bUseTempStream=*/true);
     std::vector<SignatureInformation>& rInformations = 
aManager.maCurrentSignatureInformations;
     CPPUNIT_ASSERT_EQUAL(static_cast<std::size_t>(1), rInformations.size());
     // This was SecurityOperationStatus_UNKNOWN, signing with an ECDSA key was
     // broken.
     
CPPUNIT_ASSERT_EQUAL(css::xml::crypto::SecurityOperationStatus_OPERATION_SUCCEEDED,
                          rInformations[0].nStatus);
-}*/
+}
 
 void SigningTest::testECDSAPDF()
 {

Reply via email to