[Libreoffice-commits] core.git: comphelper/CppunitTest_comphelper_test.mk comphelper/qa filter/source include/sax oox/source package/source sax/qa sax/source sc/source sd/source sfx2/source solenv/clang-format svgio/Library_svgio.mk svgio/source svx/source tools/Library_tl.mk tools/source xmloff/source xmlsecurity/source

Noel Grandin noel.grandin at collabora.co.uk
Mon Mar 5 13:25:26 UTC 2018


 comphelper/CppunitTest_comphelper_test.mk                  |    1 
 comphelper/qa/unit/base64_test.cxx                         |  106 +++++++++++++
 filter/source/svg/svgwriter.cxx                            |    3 
 filter/source/xsltfilter/OleHandler.cxx                    |    9 -
 include/sax/tools/converter.hxx                            |   12 -
 oox/source/crypto/DocumentDecryption.cxx                   |   11 -
 package/source/manifest/ManifestExport.cxx                 |   13 -
 package/source/manifest/ManifestImport.cxx                 |   13 -
 sax/qa/cppunit/test_converter.cxx                          |   42 -----
 sax/source/tools/converter.cxx                             |   18 --
 sc/source/filter/xml/XMLTrackedChangesContext.cxx          |    3 
 sc/source/filter/xml/xmlbodyi.cxx                          |    3 
 sc/source/filter/xml/xmlexprt.cxx                          |   11 -
 sc/source/filter/xml/xmlimprt.cxx                          |    3 
 sc/source/filter/xml/xmlsubti.cxx                          |    3 
 sd/source/ui/remotecontrol/ImagePreparer.cxx               |    3 
 sfx2/source/appl/sfxpicklist.cxx                           |    3 
 sfx2/source/control/recentdocsview.cxx                     |    3 
 solenv/clang-format/blacklist                              |    1 
 svgio/Library_svgio.mk                                     |    1 
 svgio/source/svgreader/svgimagenode.cxx                    |    3 
 svx/source/xoutdev/_xoutbmp.cxx                            |    5 
 tools/Library_tl.mk                                        |    1 
 tools/source/fsys/urlobj.cxx                               |    3 
 xmloff/source/core/DocumentSettingsContext.cxx             |    3 
 xmloff/source/core/SettingsExportHelper.cxx                |    3 
 xmloff/source/core/XMLBase64Export.cxx                     |    3 
 xmloff/source/core/XMLBase64ImportContext.cxx              |    3 
 xmloff/source/text/XMLSectionExport.cxx                    |    3 
 xmloff/source/text/XMLSectionImportContext.cxx             |    3 
 xmloff/source/text/XMLTextFrameContext.cxx                 |    3 
 xmloff/source/transform/OOo2Oasis.cxx                      |    3 
 xmloff/source/transform/Oasis2OOo.cxx                      |    5 
 xmlsecurity/source/component/documentdigitalsignatures.cxx |    3 
 xmlsecurity/source/helper/documentsignaturemanager.cxx     |   11 -
 35 files changed, 190 insertions(+), 127 deletions(-)

New commits:
commit ddd43218e9900536381733735adf8681d345e775
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Mon Mar 5 12:19:05 2018 +0200

    drop sax::tools::*base64 methods
    
    and use the underlying comphelper methods rather. This is so that I can
    break the dependency that tools has on sax, and can add methods that
    make sax depend on tools.
    
    Change-Id: I8a2d6ce2ffc3529a0020710ade6a1748ee5af7d5
    Reviewed-on: https://gerrit.libreoffice.org/50767
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/comphelper/CppunitTest_comphelper_test.mk b/comphelper/CppunitTest_comphelper_test.mk
index 00dc27e5e7b1..956aeb374a63 100644
--- a/comphelper/CppunitTest_comphelper_test.mk
+++ b/comphelper/CppunitTest_comphelper_test.mk
@@ -13,6 +13,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,comphelper_test, \
     comphelper/qa/string/test_string \
     comphelper/qa/container/testifcontainer \
     comphelper/qa/unit/test_hash \
+    comphelper/qa/unit/base64_test \
 ))
 
 $(eval $(call gb_CppunitTest_use_sdk_api,comphelper_test))
diff --git a/comphelper/qa/unit/base64_test.cxx b/comphelper/qa/unit/base64_test.cxx
new file mode 100644
index 000000000000..b3f2143d4a41
--- /dev/null
+++ b/comphelper/qa/unit/base64_test.cxx
@@ -0,0 +1,106 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <limits>
+
+#include <sal/types.h>
+#include <cppunit/TestAssert.h>
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/plugin/TestPlugIn.h>
+
+#include <rtl/ustrbuf.hxx>
+
+#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/util/Date.hpp>
+#include <com/sun/star/util/Duration.hpp>
+#include <com/sun/star/util/MeasureUnit.hpp>
+
+#include <comphelper/sequence.hxx>
+#include <comphelper/base64.hxx>
+#include <sal/log.hxx>
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::util;
+
+
+namespace {
+
+class Base64Test
+    : public ::CppUnit::TestFixture
+{
+public:
+
+    void testBase64();
+
+    CPPUNIT_TEST_SUITE(Base64Test);
+    CPPUNIT_TEST(testBase64);
+    CPPUNIT_TEST_SUITE_END();
+
+private:
+};
+
+
+
+void doTestEncodeBase64(char const*const pis, const uno::Sequence<sal_Int8>& aPass)
+{
+    OUString const is(OUString::createFromAscii(pis));
+    OUStringBuffer buf;
+    comphelper::Base64::encode(buf, aPass);
+    SAL_INFO("sax.cppunit","" << buf.toString());
+    CPPUNIT_ASSERT_EQUAL(is, buf.makeStringAndClear());
+}
+
+void doTestDecodeBase64(const uno::Sequence<sal_Int8>& aPass, char const*const pis)
+{
+    OUString const is(OUString::createFromAscii(pis));
+    uno::Sequence< sal_Int8 > tempSequence;
+    comphelper::Base64::decode(tempSequence, is);
+    SAL_INFO("sax.cppunit","" << is);
+    bool b = (tempSequence==aPass);
+    CPPUNIT_ASSERT(b);
+}
+
+void Base64Test::testBase64()
+{
+    std::vector< sal_Int8 > tempSeq { 0, 0, 0, 0, 0, 1, 2, 3 };
+    uno::Sequence< sal_Int8 > tempSequence = comphelper::containerToSequence(tempSeq);
+    doTestEncodeBase64("AAAAAAABAgM=", tempSequence);
+    doTestDecodeBase64(tempSequence, "AAAAAAABAgM=");
+    tempSeq[0] = sal_Int8(5);
+    tempSeq[1] = sal_Int8(2);
+    tempSeq[2] = sal_Int8(3);
+    tempSequence = comphelper::containerToSequence(tempSeq);
+    doTestEncodeBase64("BQIDAAABAgM=", tempSequence);
+    doTestDecodeBase64(tempSequence, "BQIDAAABAgM=");
+    tempSeq[0] = sal_Int8(sal_uInt8(200));
+    tempSeq[1] = sal_Int8(31);
+    tempSeq[2] = sal_Int8(77);
+    tempSeq[3] = sal_Int8(111);
+    tempSequence = comphelper::containerToSequence(tempSeq);
+    doTestEncodeBase64("yB9NbwABAgM=", tempSequence);
+    doTestDecodeBase64(tempSequence, "yB9NbwABAgM=");
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(Base64Test);
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index f72317933420..a37c8d001843 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -21,6 +21,7 @@
 #include "svgfontexport.hxx"
 #include "svgwriter.hxx"
 
+#include <comphelper/base64.hxx>
 #include <rtl/crc.h>
 #include <vcl/unohelp.hxx>
 #include <vcl/outdev.hxx>
@@ -2731,7 +2732,7 @@ void SVGActionWriter::ImplWriteBmp( const BitmapEx& rBmpEx,
                 Size                     aSz;
                 Sequence< sal_Int8 >     aSeq( static_cast<sal_Int8 const *>(aOStm.GetData()), aOStm.Tell() );
                 OUStringBuffer aBuffer( "data:image/png;base64," );
-                ::sax::Converter::encodeBase64( aBuffer, aSeq );
+                ::comphelper::Base64::encode( aBuffer, aSeq );
 
                 ImplMap( rPt, aPt );
                 ImplMap( rSz, aSz );
diff --git a/filter/source/xsltfilter/OleHandler.cxx b/filter/source/xsltfilter/OleHandler.cxx
index 799465f0ca1b..4a1d1c8f1cd1 100644
--- a/filter/source/xsltfilter/OleHandler.cxx
+++ b/filter/source/xsltfilter/OleHandler.cxx
@@ -30,6 +30,7 @@
 #include <package/Deflater.hxx>
 
 #include <cppuhelper/factory.hxx>
+#include <comphelper/base64.hxx>
 #include <comphelper/processfactory.hxx>
 #include <com/sun/star/uno/Any.hxx>
 #include <com/sun/star/uno/XInterface.hpp>
@@ -75,7 +76,7 @@ namespace XSLT
     void OleHandler::initRootStorageFromBase64(const OString& content)
     {
         Sequence<sal_Int8> oleData;
-        ::sax::Converter::decodeBase64(oleData, OStringToOUString(
+        ::comphelper::Base64::decode(oleData, OStringToOUString(
             content, RTL_TEXTENCODING_UTF8));
         m_rootStream = createTempFile();
         Reference<XOutputStream> xOutput = m_rootStream->getOutputStream();
@@ -142,7 +143,7 @@ namespace XSLT
         decompresser.reset();
         //return the base64 string of the uncompressed data
         OUStringBuffer buf(oleLength);
-        ::sax::Converter::encodeBase64(buf, result);
+        ::comphelper::Base64::encode(buf, result);
         return OUStringToOString(buf.toString(), RTL_TEXTENCODING_UTF8);
     }
 
@@ -175,7 +176,7 @@ namespace XSLT
             xInput->readBytes(oledata, oleLength);
             //return the base64 encoded string
             OUStringBuffer buf(oleLength);
-            ::sax::Converter::encodeBase64(buf, oledata);
+            ::comphelper::Base64::encode(buf, oledata);
             return OUStringToOString(buf.toString(), RTL_TEXTENCODING_UTF8);
         }
         return encodeSubStorage(streamName);
@@ -186,7 +187,7 @@ namespace XSLT
     {
         //decode the base64 string
         Sequence<sal_Int8> oledata;
-        ::sax::Converter::decodeBase64(oledata,
+        ::comphelper::Base64::decode(oledata,
                 OStringToOUString(content, RTL_TEXTENCODING_ASCII_US));
         //create a temp stream to write data to
         Reference<XStream> subStream = createTempFile();
diff --git a/include/sax/tools/converter.hxx b/include/sax/tools/converter.hxx
index b98516a9da87..2dfc33461919 100644
--- a/include/sax/tools/converter.hxx
+++ b/include/sax/tools/converter.hxx
@@ -194,18 +194,6 @@ public:
     static sal_Int32 indexOfComma( const OUString& rStr,
                                    sal_Int32 nPos );
 
-    /** encodes the given byte sequence into Base64 */
-    static void encodeBase64(OUStringBuffer& aStrBuffer, const css::uno::Sequence<sal_Int8>& aPass);
-
-    // Decode a base 64 encoded string into a sequence of bytes. The first
-    // version can be used for attribute values only, because it does not
-    // return any chars left from conversion.
-    // For text submitted throgh the SAX characters call, the later method
-    // must be used!
-    static void decodeBase64(css::uno::Sequence<sal_Int8>& aPass, const OUString& sBuffer);
-
-    static sal_Int32 decodeBase64SomeChars(css::uno::Sequence<sal_Int8>& aPass, const OUString& sBuffer);
-
     static double GetConversionFactor(OUStringBuffer& rUnit, sal_Int16 nSourceUnit, sal_Int16 nTargetUnit);
     static sal_Int16 GetUnitFromString(const OUString& rString, sal_Int16 nDefaultUnit);
 
diff --git a/oox/source/crypto/DocumentDecryption.cxx b/oox/source/crypto/DocumentDecryption.cxx
index 5f5940ad01db..bd8dff7e022a 100644
--- a/oox/source/crypto/DocumentDecryption.cxx
+++ b/oox/source/crypto/DocumentDecryption.cxx
@@ -10,6 +10,7 @@
 
 #include <oox/crypto/DocumentDecryption.hxx>
 
+#include <comphelper/base64.hxx>
 #include <comphelper/sequenceashashmap.hxx>
 #include <sax/tools/converter.hxx>
 #include <cppuhelper/implbase.hxx>
@@ -90,7 +91,7 @@ public:
                 if (localname(rAttribute.Name) == "saltValue")
                 {
                     Sequence<sal_Int8> keyDataSalt;
-                    ::sax::Converter::decodeBase64(keyDataSalt, rAttribute.Value);
+                    ::comphelper::Base64::decode(keyDataSalt, rAttribute.Value);
                     mInfo.keyDataSalt = convertToVector(keyDataSalt);
                 }
             }
@@ -135,25 +136,25 @@ public:
                 else if (rAttrLocalName == "saltValue")
                 {
                     Sequence<sal_Int8> saltValue;
-                    ::sax::Converter::decodeBase64(saltValue, rAttribute.Value);
+                    ::comphelper::Base64::decode(saltValue, rAttribute.Value);
                     mInfo.saltValue = convertToVector(saltValue);
                 }
                 else if (rAttrLocalName == "encryptedVerifierHashInput")
                 {
                     Sequence<sal_Int8> encryptedVerifierHashInput;
-                    ::sax::Converter::decodeBase64(encryptedVerifierHashInput, rAttribute.Value);
+                    ::comphelper::Base64::decode(encryptedVerifierHashInput, rAttribute.Value);
                     mInfo.encryptedVerifierHashInput = convertToVector(encryptedVerifierHashInput);
                 }
                 else if (rAttrLocalName == "encryptedVerifierHashValue")
                 {
                     Sequence<sal_Int8> encryptedVerifierHashValue;
-                    ::sax::Converter::decodeBase64(encryptedVerifierHashValue, rAttribute.Value);
+                    ::comphelper::Base64::decode(encryptedVerifierHashValue, rAttribute.Value);
                     mInfo.encryptedVerifierHashValue = convertToVector(encryptedVerifierHashValue);
                 }
                 else if (rAttrLocalName == "encryptedKeyValue")
                 {
                     Sequence<sal_Int8> encryptedKeyValue;
-                    ::sax::Converter::decodeBase64(encryptedKeyValue, rAttribute.Value);
+                    ::comphelper::Base64::decode(encryptedKeyValue, rAttribute.Value);
                     mInfo.encryptedKeyValue = convertToVector(encryptedKeyValue);
                 }
             }
diff --git a/package/source/manifest/ManifestExport.cxx b/package/source/manifest/ManifestExport.cxx
index a43eafdbd7be..46ace993b581 100644
--- a/package/source/manifest/ManifestExport.cxx
+++ b/package/source/manifest/ManifestExport.cxx
@@ -32,6 +32,7 @@
 
 #include <osl/diagnose.h>
 #include <rtl/ustrbuf.hxx>
+#include <comphelper/base64.hxx>
 #include <comphelper/documentconstants.hxx>
 #include <comphelper/attributelist.hxx>
 
@@ -281,7 +282,7 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con
                     xHandler->ignorableWhitespace ( sWhiteSpace );
 
                     xHandler->startElement( sPgpKeyIDElement, nullptr );
-                    ::sax::Converter::encodeBase64(aBuffer, aPgpKeyID);
+                    ::comphelper::Base64::encode(aBuffer, aPgpKeyID);
                     xHandler->characters( aBuffer.makeStringAndClear() );
                     xHandler->endElement( sPgpKeyIDElement );
                     xHandler->ignorableWhitespace ( sWhiteSpace );
@@ -290,7 +291,7 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con
                     if (aPgpKeyPacket.hasElements())
                     {
                         xHandler->startElement( sPGPKeyPacketElement, nullptr );
-                        ::sax::Converter::encodeBase64(aBuffer, aPgpKeyPacket);
+                        ::comphelper::Base64::encode(aBuffer, aPgpKeyPacket);
                         xHandler->characters( aBuffer.makeStringAndClear() );
                         xHandler->endElement( sPGPKeyPacketElement );
                         xHandler->ignorableWhitespace ( sWhiteSpace );
@@ -306,7 +307,7 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con
                     xHandler->ignorableWhitespace ( sWhiteSpace );
 
                     xHandler->startElement( sCipherValueElement, nullptr );
-                    ::sax::Converter::encodeBase64(aBuffer, aCipherValue);
+                    ::comphelper::Base64::encode(aBuffer, aCipherValue);
                     xHandler->characters( aBuffer.makeStringAndClear() );
                     xHandler->endElement( sCipherValueElement );
                     xHandler->ignorableWhitespace ( sWhiteSpace );
@@ -402,7 +403,7 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con
 
             pNewAttrList->AddAttribute ( sChecksumTypeAttribute, sCdataAttribute, sChecksumType );
             *pDigest >>= aSequence;
-            ::sax::Converter::encodeBase64(aBuffer, aSequence);
+            ::comphelper::Base64::encode(aBuffer, aSequence);
             pNewAttrList->AddAttribute ( sChecksumAttribute, sCdataAttribute, aBuffer.makeStringAndClear() );
 
             xHandler->startElement( sEncryptionDataElement , xNewAttrList);
@@ -435,7 +436,7 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con
             pNewAttrList->AddAttribute ( sAlgorithmNameAttribute, sCdataAttribute, sEncAlgName );
 
             *pVector >>= aSequence;
-            ::sax::Converter::encodeBase64(aBuffer, aSequence);
+            ::comphelper::Base64::encode(aBuffer, aSequence);
             pNewAttrList->AddAttribute ( sInitialisationVectorAttribute, sCdataAttribute, aBuffer.makeStringAndClear() );
 
             xHandler->ignorableWhitespace ( sWhiteSpace );
@@ -474,7 +475,7 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con
                 pNewAttrList->AddAttribute ( sIterationCountAttribute, sCdataAttribute, aBuffer.makeStringAndClear() );
 
                 *pSalt >>= aSequence;
-                ::sax::Converter::encodeBase64(aBuffer, aSequence);
+                ::comphelper::Base64::encode(aBuffer, aSequence);
                 pNewAttrList->AddAttribute ( sSaltAttribute, sCdataAttribute, aBuffer.makeStringAndClear() );
             }
 
diff --git a/package/source/manifest/ManifestImport.cxx b/package/source/manifest/ManifestImport.cxx
index 98a9d61128b5..916db4c3c694 100644
--- a/package/source/manifest/ManifestImport.cxx
+++ b/package/source/manifest/ManifestImport.cxx
@@ -25,6 +25,7 @@
 #include <com/sun/star/xml/crypto/DigestID.hpp>
 #include <com/sun/star/xml/crypto/CipherID.hpp>
 #include <com/sun/star/beans/PropertyValue.hpp>
+#include <comphelper/base64.hxx>
 #include <comphelper/sequence.hxx>
 
 using namespace com::sun::star::uno;
@@ -176,7 +177,7 @@ void ManifestImport::doEncryptedCipherValue()
     {
         aKeyInfoSequence[2].Name = "CipherValue";
         uno::Sequence < sal_Int8 > aDecodeBuffer;
-        ::sax::Converter::decodeBase64(aDecodeBuffer, aCurrentCharacters);
+        ::comphelper::Base64::decode(aDecodeBuffer, aCurrentCharacters);
         aKeyInfoSequence[2].Value <<= aDecodeBuffer;
         aCurrentCharacters = ""; // consumed
     }
@@ -190,7 +191,7 @@ void ManifestImport::doEncryptedKeyId()
     {
         aKeyInfoSequence[0].Name = "KeyId";
         uno::Sequence < sal_Int8 > aDecodeBuffer;
-        ::sax::Converter::decodeBase64(aDecodeBuffer, aCurrentCharacters);
+        ::comphelper::Base64::decode(aDecodeBuffer, aCurrentCharacters);
         aKeyInfoSequence[0].Value <<= aDecodeBuffer;
         aCurrentCharacters = ""; // consumed
     }
@@ -204,7 +205,7 @@ void ManifestImport::doEncryptedKeyPacket()
     {
         aKeyInfoSequence[1].Name = "KeyPacket";
         uno::Sequence < sal_Int8 > aDecodeBuffer;
-        ::sax::Converter::decodeBase64(aDecodeBuffer, aCurrentCharacters);
+        ::comphelper::Base64::decode(aDecodeBuffer, aCurrentCharacters);
         aKeyInfoSequence[1].Value <<= aDecodeBuffer;
         aCurrentCharacters = ""; // consumed
     }
@@ -231,7 +232,7 @@ void ManifestImport::doEncryptionData(StringHashMap &rConvertedAttribs)
         if ( !bIgnoreEncryptData ) {
             aString = rConvertedAttribs[sChecksumAttribute];
             uno::Sequence < sal_Int8 > aDecodeBuffer;
-            ::sax::Converter::decodeBase64(aDecodeBuffer, aString);
+            ::comphelper::Base64::decode(aDecodeBuffer, aString);
             aSequence[PKG_MNFST_DIGEST].Name = sDigestProperty;
             aSequence[PKG_MNFST_DIGEST].Value <<= aDecodeBuffer;
         }
@@ -266,7 +267,7 @@ void ManifestImport::doAlgorithm(StringHashMap &rConvertedAttribs)
         if ( !bIgnoreEncryptData ) {
             aString = rConvertedAttribs[sInitialisationVectorAttribute];
             uno::Sequence < sal_Int8 > aDecodeBuffer;
-            ::sax::Converter::decodeBase64(aDecodeBuffer, aString);
+            ::comphelper::Base64::decode(aDecodeBuffer, aString);
             aSequence[PKG_MNFST_INIVECTOR].Name = sInitialisationVectorProperty;
             aSequence[PKG_MNFST_INIVECTOR].Value <<= aDecodeBuffer;
         }
@@ -280,7 +281,7 @@ void ManifestImport::doKeyDerivation(StringHashMap &rConvertedAttribs)
         if ( aString == sPBKDF2_Name || aString == sPBKDF2_URL ) {
             aString = rConvertedAttribs[sSaltAttribute];
             uno::Sequence < sal_Int8 > aDecodeBuffer;
-            ::sax::Converter::decodeBase64(aDecodeBuffer, aString);
+            ::comphelper::Base64::decode(aDecodeBuffer, aString);
             aSequence[PKG_MNFST_SALT].Name = sSaltProperty;
             aSequence[PKG_MNFST_SALT].Value <<= aDecodeBuffer;
 
diff --git a/sax/qa/cppunit/test_converter.cxx b/sax/qa/cppunit/test_converter.cxx
index 1487acbb8607..3426b51aa090 100644
--- a/sax/qa/cppunit/test_converter.cxx
+++ b/sax/qa/cppunit/test_converter.cxx
@@ -58,7 +58,6 @@ public:
     void testPercent();
     void testColor();
     void testNumber();
-    void testBase64();
 
     CPPUNIT_TEST_SUITE(ConverterTest);
     CPPUNIT_TEST(testDuration);
@@ -70,7 +69,6 @@ public:
     CPPUNIT_TEST(testPercent);
     CPPUNIT_TEST(testColor);
     CPPUNIT_TEST(testNumber);
-    CPPUNIT_TEST(testBase64);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -617,46 +615,6 @@ void ConverterTest::testNumber()
     doTestStringToNumber(0, "666", -0, 0);
 }
 
-void doTestEncodeBase64(char const*const pis, const uno::Sequence<sal_Int8>& aPass)
-{
-    OUString const is(OUString::createFromAscii(pis));
-    OUStringBuffer buf;
-    Converter::encodeBase64(buf, aPass);
-    SAL_INFO("sax.cppunit","" << buf.toString());
-    CPPUNIT_ASSERT_EQUAL(is, buf.makeStringAndClear());
-}
-
-void doTestDecodeBase64(const uno::Sequence<sal_Int8>& aPass, char const*const pis)
-{
-    OUString const is(OUString::createFromAscii(pis));
-    uno::Sequence< sal_Int8 > tempSequence;
-    Converter::decodeBase64(tempSequence, is);
-    SAL_INFO("sax.cppunit","" << is);
-    bool b = (tempSequence==aPass);
-    CPPUNIT_ASSERT(b);
-}
-
-void ConverterTest::testBase64()
-{
-    std::vector< sal_Int8 > tempSeq { 0, 0, 0, 0, 0, 1, 2, 3 };
-    uno::Sequence< sal_Int8 > tempSequence = comphelper::containerToSequence(tempSeq);
-    doTestEncodeBase64("AAAAAAABAgM=", tempSequence);
-    doTestDecodeBase64(tempSequence, "AAAAAAABAgM=");
-    tempSeq[0] = sal_Int8(5);
-    tempSeq[1] = sal_Int8(2);
-    tempSeq[2] = sal_Int8(3);
-    tempSequence = comphelper::containerToSequence(tempSeq);
-    doTestEncodeBase64("BQIDAAABAgM=", tempSequence);
-    doTestDecodeBase64(tempSequence, "BQIDAAABAgM=");
-    tempSeq[0] = sal_Int8(sal_uInt8(200));
-    tempSeq[1] = sal_Int8(31);
-    tempSeq[2] = sal_Int8(77);
-    tempSeq[3] = sal_Int8(111);
-    tempSequence = comphelper::containerToSequence(tempSeq);
-    doTestEncodeBase64("yB9NbwABAgM=", tempSequence);
-    doTestDecodeBase64(tempSequence, "yB9NbwABAgM=");
-}
-
 CPPUNIT_TEST_SUITE_REGISTRATION(ConverterTest);
 
 }
diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx
index d5618128a231..250c756e64e6 100644
--- a/sax/source/tools/converter.cxx
+++ b/sax/source/tools/converter.cxx
@@ -32,7 +32,6 @@
 #include <rtl/math.hxx>
 #include <sal/log.hxx>
 #include <osl/diagnose.h>
-#include <comphelper/base64.hxx>
 
 #include <algorithm>
 
@@ -1903,23 +1902,6 @@ sal_Int32 Converter::indexOfComma( const OUString& rStr,
     return -1;
 }
 
-void Converter::encodeBase64(OUStringBuffer& aStrBuffer, const uno::Sequence<sal_Int8>& aPass)
-{
-    comphelper::Base64::encode(aStrBuffer, aPass);
-}
-
-void Converter::decodeBase64(uno::Sequence<sal_Int8>& aBuffer, const OUString& sBuffer)
-{
-    comphelper::Base64::decode(aBuffer, sBuffer);
-}
-
-sal_Int32 Converter::decodeBase64SomeChars(
-        uno::Sequence<sal_Int8>& rOutBuffer,
-        const OUString& rInBuffer)
-{
-    return comphelper::Base64::decodeSomeChars(rOutBuffer, rInBuffer);
-}
-
 double Converter::GetConversionFactor(OUStringBuffer& rUnit, sal_Int16 nSourceUnit, sal_Int16 nTargetUnit)
 {
     double fRetval(1.0);
diff --git a/sc/source/filter/xml/XMLTrackedChangesContext.cxx b/sc/source/filter/xml/XMLTrackedChangesContext.cxx
index 223f26db9764..86e1dcba2efc 100644
--- a/sc/source/filter/xml/XMLTrackedChangesContext.cxx
+++ b/sc/source/filter/xml/XMLTrackedChangesContext.cxx
@@ -33,6 +33,7 @@
 #include <sax/tools/converter.hxx>
 #include <svl/zforlist.hxx>
 #include <svl/sharedstringpool.hxx>
+#include <comphelper/base64.hxx>
 #include <com/sun/star/text/XTextCursor.hpp>
 #include <com/sun/star/text/ControlCharacter.hpp>
 
@@ -375,7 +376,7 @@ ScXMLTrackedChangesContext::ScXMLTrackedChangesContext( ScXMLImport& rImport,
             if( !aIter.isEmpty() )
             {
                 uno::Sequence<sal_Int8> aPass;
-                ::sax::Converter::decodeBase64( aPass, aIter.toString() );
+                ::comphelper::Base64::decode( aPass, aIter.toString() );
                 pChangeTrackingImportHelper->SetProtection(aPass);
             }
         }
diff --git a/sc/source/filter/xml/xmlbodyi.cxx b/sc/source/filter/xml/xmlbodyi.cxx
index 226db0ab313c..e7068ce9fcec 100644
--- a/sc/source/filter/xml/xmlbodyi.cxx
+++ b/sc/source/filter/xml/xmlbodyi.cxx
@@ -49,6 +49,7 @@
 #include <xmloff/xmlnmspe.hxx>
 #include <xmloff/nmspmap.hxx>
 
+#include <comphelper/base64.hxx>
 #include <sax/tools/converter.hxx>
 #include <sal/types.h>
 
@@ -265,7 +266,7 @@ void SAL_CALL ScXMLBodyContext::endFastElement(sal_Int32 nElement)
             uno::Sequence<sal_Int8> aPass;
             if (!sPassword.isEmpty())
             {
-                ::sax::Converter::decodeBase64(aPass, sPassword);
+                ::comphelper::Base64::decode(aPass, sPassword);
                 pProtection->setPasswordHash(aPass, meHash1, meHash2);
             }
 
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index e02f32f8c7bd..d41bc3ba2b5a 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -111,6 +111,7 @@
 #include <rtl/math.hxx>
 #include <svl/zforlist.hxx>
 #include <svx/unoshape.hxx>
+#include <comphelper/base64.hxx>
 #include <comphelper/extract.hxx>
 #include <toolkit/helper/convert.hxx>
 #include <svx/svdobj.hxx>
@@ -1713,7 +1714,7 @@ void ScXMLExport::SetBodyAttributes()
                 eHashUsed = PASSHASH_XL;
             }
         }
-        ::sax::Converter::encodeBase64(aBuffer, aPassHash);
+        ::comphelper::Base64::encode(aBuffer, aPassHash);
         if (!aBuffer.isEmpty())
         {
             AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTION_KEY, aBuffer.makeStringAndClear());
@@ -2848,13 +2849,13 @@ void ScXMLExport::WriteTable(sal_Int32 nTable, const uno::Reference<sheet::XSpre
                 ScPasswordHash eHashUsed = PASSHASH_UNSPECIFIED;
                 if (pProtect->hasPasswordHash(PASSHASH_SHA1))
                 {
-                    ::sax::Converter::encodeBase64(aBuffer,
+                    ::comphelper::Base64::encode(aBuffer,
                         pProtect->getPasswordHash(PASSHASH_SHA1));
                     eHashUsed = PASSHASH_SHA1;
                 }
                 else if (pProtect->hasPasswordHash(PASSHASH_SHA256))
                 {
-                    ::sax::Converter::encodeBase64(aBuffer,
+                    ::comphelper::Base64::encode(aBuffer,
                         pProtect->getPasswordHash(PASSHASH_SHA256));
                     eHashUsed = PASSHASH_SHA256;
                 }
@@ -2862,7 +2863,7 @@ void ScXMLExport::WriteTable(sal_Int32 nTable, const uno::Reference<sheet::XSpre
                 {
                     // Double-hash this by SHA1 on top of the legacy xls hash.
                     uno::Sequence<sal_Int8> aHash = pProtect->getPasswordHash(PASSHASH_XL, PASSHASH_SHA1);
-                    ::sax::Converter::encodeBase64(aBuffer, aHash);
+                    ::comphelper::Base64::encode(aBuffer, aHash);
                     eHashUsed = PASSHASH_XL;
                 }
                 if (!aBuffer.isEmpty())
@@ -4906,7 +4907,7 @@ void ScXMLExport::GetConfigurationSettings(uno::Sequence<beans::PropertyValue>&
             OUStringBuffer aTrackedChangesKey;
             if (GetDocument() && GetDocument()->GetChangeTrack() && GetDocument()->GetChangeTrack()->IsProtected())
             {
-                ::sax::Converter::encodeBase64(aTrackedChangesKey,
+                ::comphelper::Base64::encode(aTrackedChangesKey,
                         GetDocument()->GetChangeTrack()->GetProtection());
                 if (!aTrackedChangesKey.isEmpty())
                     ++nPropsToAdd;
diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx
index b521ebedb7a7..4e2c3bb56531 100644
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@ -77,6 +77,7 @@
 #include <unonames.hxx>
 #include <numformat.hxx>
 
+#include <comphelper/base64.hxx>
 #include <comphelper/extract.hxx>
 #include <comphelper/propertysequence.hxx>
 
@@ -1186,7 +1187,7 @@ void ScXMLImport::SetConfigurationSettings(const uno::Sequence<beans::PropertyVa
                     if (aConfigProps[i].Value >>= sKey)
                     {
                         uno::Sequence<sal_Int8> aPass;
-                        ::sax::Converter::decodeBase64(aPass, sKey);
+                        ::comphelper::Base64::decode(aPass, sKey);
                         if (aPass.getLength())
                         {
                             if (pDoc->GetChangeTrack())
diff --git a/sc/source/filter/xml/xmlsubti.cxx b/sc/source/filter/xml/xmlsubti.cxx
index 6f1033ef37a4..a71d38ed263e 100644
--- a/sc/source/filter/xml/xmlsubti.cxx
+++ b/sc/source/filter/xml/xmlsubti.cxx
@@ -39,6 +39,7 @@
 #include <xmloff/xmltkmap.hxx>
 #include <xmloff/nmspmap.hxx>
 #include <xmloff/xmlerror.hxx>
+#include <comphelper/base64.hxx>
 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
 #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
 
@@ -200,7 +201,7 @@ void ScMyTables::DeleteTable()
     if (rImport.GetDocument() && maProtectionData.mbProtected)
     {
         uno::Sequence<sal_Int8> aHash;
-        ::sax::Converter::decodeBase64(aHash, maProtectionData.maPassword);
+        ::comphelper::Base64::decode(aHash, maProtectionData.maPassword);
 
         std::unique_ptr<ScTableProtection> pProtect(new ScTableProtection);
         pProtect->setProtected(maProtectionData.mbProtected);
diff --git a/sd/source/ui/remotecontrol/ImagePreparer.cxx b/sd/source/ui/remotecontrol/ImagePreparer.cxx
index 199d3d434c54..ee9614249bac 100644
--- a/sd/source/ui/remotecontrol/ImagePreparer.cxx
+++ b/sd/source/ui/remotecontrol/ImagePreparer.cxx
@@ -19,6 +19,7 @@
 
 #include "ImagePreparer.hxx"
 
+#include <comphelper/base64.hxx>
 #include <comphelper/processfactory.hxx>
 #include <osl/file.hxx>
 #include <rtl/ustrbuf.hxx>
@@ -88,7 +89,7 @@ void ImagePreparer::sendPreview( sal_uInt32 aSlideNumber )
         return;
 
     OUStringBuffer aStrBuffer;
-    ::sax::Converter::encodeBase64( aStrBuffer, aImageData );
+    ::comphelper::Base64::encode( aStrBuffer, aImageData );
 
     OString aEncodedShortString = OUStringToOString(
         aStrBuffer.makeStringAndClear(), RTL_TEXTENCODING_UTF8 );
diff --git a/sfx2/source/appl/sfxpicklist.cxx b/sfx2/source/appl/sfxpicklist.cxx
index 2aaccbc6001a..cb9b54426d2b 100644
--- a/sfx2/source/appl/sfxpicklist.cxx
+++ b/sfx2/source/appl/sfxpicklist.cxx
@@ -20,6 +20,7 @@
 #include <config_features.h>
 
 #include <comphelper/lok.hxx>
+#include <comphelper/base64.hxx>
 #include <com/sun/star/document/XDocumentProperties.hpp>
 #include <unotools/historyoptions.hxx>
 #include <unotools/useroptions.hxx>
@@ -157,7 +158,7 @@ void SfxPickListImpl::AddDocumentToPickList( SfxObjectShell* pDocSh )
                 {
                     Sequence<sal_Int8> aSequence(static_cast<const sal_Int8*>(aStream.GetData()), aStream.Tell());
                     OUStringBuffer aBuffer;
-                    ::sax::Converter::encodeBase64(aBuffer, aSequence);
+                    ::comphelper::Base64::encode(aBuffer, aSequence);
                     aThumbnail = aBuffer.makeStringAndClear();
                 }
             }
diff --git a/sfx2/source/control/recentdocsview.cxx b/sfx2/source/control/recentdocsview.cxx
index 3be2690f0688..1a5af971af4f 100644
--- a/sfx2/source/control/recentdocsview.cxx
+++ b/sfx2/source/control/recentdocsview.cxx
@@ -17,6 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <comphelper/base64.hxx>
 #include <sax/tools/converter.hxx>
 #include <sfx2/recentdocsview.hxx>
 #include <sfx2/templatelocalview.hxx>
@@ -190,7 +191,7 @@ void RecentDocsView::Reload()
                 if (!aBase64.isEmpty())
                 {
                     Sequence<sal_Int8> aDecoded;
-                    sax::Converter::decodeBase64(aDecoded, aBase64);
+                    comphelper::Base64::decode(aDecoded, aBase64);
 
                     SvMemoryStream aStream(aDecoded.getArray(), aDecoded.getLength(), StreamMode::READ);
                     vcl::PNGReader aReader(aStream);
diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist
index b2f6e761a6a3..a8c7c1e945dc 100644
--- a/solenv/clang-format/blacklist
+++ b/solenv/clang-format/blacklist
@@ -1593,6 +1593,7 @@ comphelper/inc/pch/precompiled_comphelper.hxx
 comphelper/qa/container/comphelper_ifcontainer.cxx
 comphelper/qa/container/testifcontainer.cxx
 comphelper/qa/string/test_string.cxx
+comphelper/qa/unit/base64_test.cxx
 comphelper/qa/unit/syntaxhighlighttest.cxx
 comphelper/qa/unit/test_hash.cxx
 comphelper/qa/unit/threadpooltest.cxx
diff --git a/svgio/Library_svgio.mk b/svgio/Library_svgio.mk
index 3ba1891d691b..44d8ef9c05b5 100644
--- a/svgio/Library_svgio.mk
+++ b/svgio/Library_svgio.mk
@@ -34,6 +34,7 @@ $(eval $(call gb_Library_use_sdk_api,svgio))
 $(eval $(call gb_Library_use_libraries,svgio,\
     basegfx \
     drawinglayer \
+    comphelper \
     cppu \
     cppuhelper \
     sal \
diff --git a/svgio/source/svgreader/svgimagenode.cxx b/svgio/source/svgreader/svgimagenode.cxx
index db66e18aab2a..647048e07850 100644
--- a/svgio/source/svgreader/svgimagenode.cxx
+++ b/svgio/source/svgreader/svgimagenode.cxx
@@ -32,6 +32,7 @@
 #include <basegfx/polygon/b2dpolygon.hxx>
 #include <rtl/uri.hxx>
 #include <drawinglayer/geometry/viewinformation2d.hxx>
+#include <comphelper/base64.hxx>
 
 namespace svgio
 {
@@ -212,7 +213,7 @@ namespace svgio
                     {
                         // use embedded base64 encoded data
                         css::uno::Sequence< sal_Int8 > aPass;
-                        ::sax::Converter::decodeBase64(aPass, maData);
+                        ::comphelper::Base64::decode(aPass, maData);
 
                         if(aPass.hasElements())
                         {
diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx
index 1220a72f93bd..a6e072197e8c 100644
--- a/svx/source/xoutdev/_xoutbmp.cxx
+++ b/svx/source/xoutdev/_xoutbmp.cxx
@@ -19,6 +19,7 @@
 
 #include <sal/config.h>
 
+#include <comphelper/base64.hxx>
 #include <tools/poly.hxx>
 #include <vcl/bitmapaccess.hxx>
 #include <vcl/virdev.hxx>
@@ -391,7 +392,7 @@ bool XOutBitmap::GraphicToBase64(const Graphic& rGraphic, OUString& rOUString)
     aOStm.Seek(STREAM_SEEK_TO_END);
     css::uno::Sequence<sal_Int8> aOStmSeq( static_cast<sal_Int8 const *>(aOStm.GetData()),aOStm.Tell() );
     OUStringBuffer aStrBuffer;
-    ::sax::Converter::encodeBase64(aStrBuffer,aOStmSeq);
+    ::comphelper::Base64::encode(aStrBuffer,aOStmSeq);
     OUString aEncodedBase64Image = aStrBuffer.makeStringAndClear();
     if( aLink.GetType() == GfxLinkType::NativeSvg )
     {
@@ -405,7 +406,7 @@ bool XOutBitmap::GraphicToBase64(const Graphic& rGraphic, OUString& rOUString)
         *pOutBuffer++ = pBuffer[ite];
         ite++;
       }
-      ::sax::Converter::encodeBase64(aStrBuffer, newTempSeq);
+      ::comphelper::Base64::encode(aStrBuffer, newTempSeq);
       aEncodedBase64Image = aStrBuffer.makeStringAndClear();
       sal_Int32 SVGFixLength = aEncodedBase64Image.getLength();
       aEncodedBase64Image = aEncodedBase64Image.replaceAt(SVGFixLength - 12, SVGFixLength, "") + "PC9zdmc+Cg=="; // removes rear 12 bits of garbage and adds svg closing tag in base64
diff --git a/tools/Library_tl.mk b/tools/Library_tl.mk
index ec19ac5100c4..69b3149251e4 100644
--- a/tools/Library_tl.mk
+++ b/tools/Library_tl.mk
@@ -38,7 +38,6 @@ $(eval $(call gb_Library_use_libraries,tl,\
     i18nlangtag \
     cppu \
     sal \
-    sax \
 ))
 
 
diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx
index c6e74ddffc58..91326c0a81e0 100644
--- a/tools/source/fsys/urlobj.cxx
+++ b/tools/source/fsys/urlobj.cxx
@@ -45,6 +45,7 @@
 #include <com/sun/star/uno/Sequence.hxx>
 #include <sax/tools/converter.hxx>
 #include <rtl/uri.hxx>
+#include <comphelper/base64.hxx>
 
 using namespace css;
 
@@ -615,7 +616,7 @@ std::unique_ptr<SvMemoryStream> INetURLObject::getData() const
         nCharactersSkipped += strlen(";base64,");
         OUString sBase64Data = sURLPath.copy( nCharactersSkipped );
         css::uno::Sequence< sal_Int8 > aDecodedData;
-        if (sax::Converter::decodeBase64SomeChars(aDecodedData, sBase64Data)
+        if (comphelper::Base64::decodeSomeChars(aDecodedData, sBase64Data)
             == sBase64Data.getLength())
         {
             return memoryStream(
diff --git a/xmloff/source/core/DocumentSettingsContext.cxx b/xmloff/source/core/DocumentSettingsContext.cxx
index 02965c05b822..8d4c2c05ba59 100644
--- a/xmloff/source/core/DocumentSettingsContext.cxx
+++ b/xmloff/source/core/DocumentSettingsContext.cxx
@@ -31,6 +31,7 @@
 #include <xmloff/nmspmap.hxx>
 #include <xmloff/xmluconv.hxx>
 #include <comphelper/processfactory.hxx>
+#include <comphelper/base64.hxx>
 
 #include <vector>
 #include <com/sun/star/i18n/XForbiddenCharacters.hpp>
@@ -498,7 +499,7 @@ void XMLConfigItemContext::Characters( const OUString& rChars )
             }
             uno::Sequence<sal_Int8> aBuffer((sChars.getLength() / 4) * 3 );
             sal_Int32 const nCharsDecoded =
-                ::sax::Converter::decodeBase64SomeChars( aBuffer, sChars );
+                ::comphelper::Base64::decodeSomeChars( aBuffer, sChars );
             sal_uInt32 nStartPos(maDecoded.getLength());
             sal_uInt32 nCount(aBuffer.getLength());
             maDecoded.realloc(nStartPos + nCount);
diff --git a/xmloff/source/core/SettingsExportHelper.cxx b/xmloff/source/core/SettingsExportHelper.cxx
index 92e2a61c94e5..045028a423f8 100644
--- a/xmloff/source/core/SettingsExportHelper.cxx
+++ b/xmloff/source/core/SettingsExportHelper.cxx
@@ -25,6 +25,7 @@
 #include <xmloff/xmltoken.hxx>
 #include <tools/debug.hxx>
 #include <tools/diagnose_ex.h>
+#include <comphelper/base64.hxx>
 #include <comphelper/extract.hxx>
 #include <comphelper/processfactory.hxx>
 
@@ -344,7 +345,7 @@ void XMLSettingsExportHelper::exportbase64Binary(
     if(nLength)
     {
         OUStringBuffer sBuffer;
-        ::sax::Converter::encodeBase64(sBuffer, aProps);
+        ::comphelper::Base64::encode(sBuffer, aProps);
         m_rContext.Characters( sBuffer.makeStringAndClear() );
     }
     m_rContext.EndElement( false );
diff --git a/xmloff/source/core/XMLBase64Export.cxx b/xmloff/source/core/XMLBase64Export.cxx
index fe431e34edd6..26efc980f443 100644
--- a/xmloff/source/core/XMLBase64Export.cxx
+++ b/xmloff/source/core/XMLBase64Export.cxx
@@ -23,6 +23,7 @@
 #include <com/sun/star/io/XInputStream.hpp>
 
 #include <sax/tools/converter.hxx>
+#include <comphelper/base64.hxx>
 
 #include <xmloff/xmlexp.hxx>
 #include <xmloff/xmlnmspe.hxx>
@@ -51,7 +52,7 @@ bool XMLBase64Export::exportXML( const Reference < XInputStream> & rIn )
             nRead = rIn->readBytes( aInBuff, INPUT_BUFFER_SIZE );
             if( nRead > 0 )
             {
-                ::sax::Converter::encodeBase64( aOutBuff, aInBuff );
+                ::comphelper::Base64::encode( aOutBuff, aInBuff );
                 GetExport().Characters( aOutBuff.makeStringAndClear() );
                 if( nRead == INPUT_BUFFER_SIZE )
                     GetExport().IgnorableWhitespace();
diff --git a/xmloff/source/core/XMLBase64ImportContext.cxx b/xmloff/source/core/XMLBase64ImportContext.cxx
index c44ddd907d3d..fd3fdae5b768 100644
--- a/xmloff/source/core/XMLBase64ImportContext.cxx
+++ b/xmloff/source/core/XMLBase64ImportContext.cxx
@@ -20,6 +20,7 @@
 #include <com/sun/star/io/XOutputStream.hpp>
 
 #include <sax/tools/converter.hxx>
+#include <comphelper/base64.hxx>
 
 #include <xmloff/xmlimp.hxx>
 #include <xmloff/XMLBase64ImportContext.hxx>
@@ -65,7 +66,7 @@ void XMLBase64ImportContext::Characters( const OUString& rChars )
         }
         Sequence< sal_Int8 > aBuffer( (sChars.getLength() / 4) * 3 );
         sal_Int32 const nCharsDecoded =
-                ::sax::Converter::decodeBase64SomeChars( aBuffer, sChars );
+                ::comphelper::Base64::decodeSomeChars( aBuffer, sChars );
         xOut->writeBytes( aBuffer );
         if( nCharsDecoded != sChars.getLength() )
             sBase64CharsLeft = sChars.copy( nCharsDecoded );
diff --git a/xmloff/source/text/XMLSectionExport.cxx b/xmloff/source/text/XMLSectionExport.cxx
index 46189a119ca7..e8c3533d5a39 100644
--- a/xmloff/source/text/XMLSectionExport.cxx
+++ b/xmloff/source/text/XMLSectionExport.cxx
@@ -42,6 +42,7 @@
 #include <com/sun/star/text/ChapterFormat.hpp>
 
 #include <sax/tools/converter.hxx>
+#include <comphelper/base64.hxx>
 
 #include <xmloff/xmltoken.hxx>
 #include <xmloff/xmlnmspe.hxx>
@@ -397,7 +398,7 @@ void XMLSectionExport::ExportRegularSectionStart(
     if (aPassword.getLength() > 0)
     {
         OUStringBuffer aBuffer;
-        ::sax::Converter::encodeBase64(aBuffer, aPassword);
+        ::comphelper::Base64::encode(aBuffer, aPassword);
         // in ODF 1.0/1.1 the algorithm was left unspecified so we can write anything
         GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_PROTECTION_KEY,
                                  aBuffer.makeStringAndClear());
diff --git a/xmloff/source/text/XMLSectionImportContext.cxx b/xmloff/source/text/XMLSectionImportContext.cxx
index 50021e9159f3..a7e971e4dc14 100644
--- a/xmloff/source/text/XMLSectionImportContext.cxx
+++ b/xmloff/source/text/XMLSectionImportContext.cxx
@@ -20,6 +20,7 @@
 #include "XMLSectionImportContext.hxx"
 #include "XMLSectionSourceImportContext.hxx"
 #include "XMLSectionSourceDDEImportContext.hxx"
+#include <comphelper/base64.hxx>
 #include <xmloff/xmlictxt.hxx>
 #include <xmloff/xmlimp.hxx>
 #include <xmloff/txtimp.hxx>
@@ -283,7 +284,7 @@ void XMLSectionImportContext::ProcessAttributes(
                 }
                 break;
             case XML_TOK_SECTION_PROTECTION_KEY:
-                ::sax::Converter::decodeBase64(aSequence, sAttr);
+                ::comphelper::Base64::decode(aSequence, sAttr);
                 bSequenceOK = true;
                 break;
             case XML_TOK_SECTION_PROTECT:
diff --git a/xmloff/source/text/XMLTextFrameContext.cxx b/xmloff/source/text/XMLTextFrameContext.cxx
index 9d60d11072dc..0580c1a70915 100644
--- a/xmloff/source/text/XMLTextFrameContext.cxx
+++ b/xmloff/source/text/XMLTextFrameContext.cxx
@@ -19,6 +19,7 @@
 
 #include <o3tl/make_unique.hxx>
 #include <osl/diagnose.h>
+#include <comphelper/base64.hxx>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/text/TextContentAnchorType.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
@@ -1215,7 +1216,7 @@ void XMLTextFrameContext_Impl::Characters( const OUString& rChars )
                 }
                 Sequence< sal_Int8 > aBuffer( (sChars.getLength() / 4) * 3 );
                 sal_Int32 nCharsDecoded =
-                    ::sax::Converter::decodeBase64SomeChars( aBuffer, sChars );
+                    ::comphelper::Base64::decodeSomeChars( aBuffer, sChars );
                 xBase64Stream->writeBytes( aBuffer );
                 if( nCharsDecoded != sChars.getLength() )
                     sBase64CharsLeft = sChars.copy( nCharsDecoded );
diff --git a/xmloff/source/transform/OOo2Oasis.cxx b/xmloff/source/transform/OOo2Oasis.cxx
index b3f7ccbefdcd..50eee3b7fb9e 100644
--- a/xmloff/source/transform/OOo2Oasis.cxx
+++ b/xmloff/source/transform/OOo2Oasis.cxx
@@ -20,6 +20,7 @@
 #include <rtl/ustrbuf.hxx>
 #include <osl/diagnose.h>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <comphelper/base64.hxx>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/servicehelper.hxx>
 #include <sax/tools/converter.hxx>
@@ -1414,7 +1415,7 @@ void XMLTrackedChangesOOoTContext_Impl::StartElement(
                     xPropSetInfo->hasPropertyByName( aPropName ) )
                 {
                     Sequence < sal_Int8 > aKey;
-                    ::sax::Converter::decodeBase64( aKey,
+                    ::comphelper::Base64::decode( aKey,
                                         rAttrList->getValueByIndex( i ) );
                     rPropSet->setPropertyValue( aPropName, makeAny( aKey ) );
                 }
diff --git a/xmloff/source/transform/Oasis2OOo.cxx b/xmloff/source/transform/Oasis2OOo.cxx
index f3e234c390ed..555cafc04576 100644
--- a/xmloff/source/transform/Oasis2OOo.cxx
+++ b/xmloff/source/transform/Oasis2OOo.cxx
@@ -17,6 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <comphelper/base64.hxx>
 #include <com/sun/star/beans/XPropertySetInfo.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <rtl/ustrbuf.hxx>
@@ -1498,7 +1499,7 @@ void XMLConfigItemTContext_Impl::EndElement()
                 xPropSetInfo->hasPropertyByName( aPropName ) )
             {
                 Sequence < sal_Int8 > aKey;
-                ::sax::Converter::decodeBase64( aKey, m_aContent );
+                ::comphelper::Base64::decode( aKey, m_aContent );
                 rPropSet->setPropertyValue( aPropName, makeAny( aKey ) );
             }
         }
@@ -1551,7 +1552,7 @@ void XMLTrackedChangesOASISTContext_Impl::StartElement(
             if( aKey.getLength() )
             {
                 OUStringBuffer aBuffer;
-                ::sax::Converter::encodeBase64( aBuffer, aKey );
+                ::comphelper::Base64::encode( aBuffer, aKey );
                 XMLMutableAttributeList *pMutableAttrList =
                     new XMLMutableAttributeList( xAttrList );
                 xAttrList = pMutableAttrList;
diff --git a/xmlsecurity/source/component/documentdigitalsignatures.cxx b/xmlsecurity/source/component/documentdigitalsignatures.cxx
index 2978bd133522..e6dab417f93c 100644
--- a/xmlsecurity/source/component/documentdigitalsignatures.cxx
+++ b/xmlsecurity/source/component/documentdigitalsignatures.cxx
@@ -41,6 +41,7 @@
 #include <vcl/weld.hxx>
 #include <unotools/securityoptions.hxx>
 #include <com/sun/star/security/CertificateValidity.hpp>
+#include <comphelper/base64.hxx>
 #include <comphelper/documentconstants.hxx>
 #include <comphelper/propertyvalue.hxx>
 #include <comphelper/sequence.hxx>
@@ -634,7 +635,7 @@ void DocumentDigitalSignatures::addAuthorToTrustedSources(
     aNewCert[ 1 ] = xmlsecurity::bigIntegerToNumericString( Author->getSerialNumber() );
 
     OUStringBuffer aStrBuffer;
-    ::sax::Converter::encodeBase64(aStrBuffer, Author->getEncoded());
+    ::comphelper::Base64::encode(aStrBuffer, Author->getEncoded());
     aNewCert[ 2 ] = aStrBuffer.makeStringAndClear();
 
 
diff --git a/xmlsecurity/source/helper/documentsignaturemanager.cxx b/xmlsecurity/source/helper/documentsignaturemanager.cxx
index 81a61791fc3a..c287b5234063 100644
--- a/xmlsecurity/source/helper/documentsignaturemanager.cxx
+++ b/xmlsecurity/source/helper/documentsignaturemanager.cxx
@@ -30,6 +30,7 @@
 #include <com/sun/star/xml/crypto/SEInitializer.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
 
+#include <comphelper/base64.hxx>
 #include <comphelper/storagehelper.hxx>
 #include <rtl/ustrbuf.hxx>
 #include <sax/tools/converter.hxx>
@@ -289,13 +290,13 @@ bool DocumentSignatureManager::add(
         nSecurityId = maSignatureHelper.GetNewSecurityId();
 
         OUStringBuffer aStrBuffer;
-        sax::Converter::encodeBase64(aStrBuffer, xCert->getEncoded());
+        comphelper::Base64::encode(aStrBuffer, xCert->getEncoded());
 
         OUString aKeyId;
         if (auto pCertificate = dynamic_cast<xmlsecurity::Certificate*>(xCert.get()))
         {
             OUStringBuffer aBuffer;
-            sax::Converter::encodeBase64(aBuffer, pCertificate->getSHA256Thumbprint());
+            comphelper::Base64::encode(aBuffer, pCertificate->getSHA256Thumbprint());
             aKeyId = aBuffer.makeStringAndClear();
         }
         else
@@ -334,13 +335,13 @@ bool DocumentSignatureManager::add(
         nSecurityId = maSignatureHelper.GetNewSecurityId();
 
         OUStringBuffer aStrBuffer;
-        sax::Converter::encodeBase64(aStrBuffer, xCert->getEncoded());
+        comphelper::Base64::encode(aStrBuffer, xCert->getEncoded());
 
         OUString aCertDigest;
         if (auto pCertificate = dynamic_cast<xmlsecurity::Certificate*>(xCert.get()))
         {
             OUStringBuffer aBuffer;
-            sax::Converter::encodeBase64(aBuffer, pCertificate->getSHA256Thumbprint());
+            comphelper::Base64::encode(aBuffer, pCertificate->getSHA256Thumbprint());
             aCertDigest = aBuffer.makeStringAndClear();
         }
         else
@@ -359,7 +360,7 @@ bool DocumentSignatureManager::add(
     OUStringBuffer aStrBuffer;
     for (int i = 0; i < nCnt; i++)
     {
-        sax::Converter::encodeBase64(aStrBuffer, pCertPath[i]->getEncoded());
+        comphelper::Base64::encode(aStrBuffer, pCertPath[i]->getEncoded());
         maSignatureHelper.AddEncapsulatedX509Certificate(aStrBuffer.makeStringAndClear());
     }
 


More information about the Libreoffice-commits mailing list