From 41335c541f2837eb9bfa7143e82c21ddf188be18 Mon Sep 17 00:00:00 2001 From: Raul Metsma Date: Wed, 16 Sep 2020 14:12:37 +0300 Subject: [PATCH] Add option to save SiVa URL to xml config IB-6839 Signed-off-by: Raul Metsma --- .github/workflows/build.yml | 10 ++++------ libdigidocpp.dox | 14 ++++++++++++++ src/XmlConf.cpp | 13 +++++++++++-- src/XmlConf.h | 4 ++++ src/libdigidocpp.i.h | 1 - test/CMakeLists.txt | 1 + test/libdigidocpp_boost.cpp | 6 +++++- 7 files changed, 39 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 23d83ce03..656905f0e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,7 +19,7 @@ jobs: - name: Install dependencies run: | brew update - brew install swig doxygen boost xsd || brew link --overwrite xsd + brew install doxygen boost xsd || brew link --overwrite xsd brew unlink xerces-c - name: Cache uses: actions/cache@v2 @@ -27,8 +27,6 @@ jobs: with: path: cache key: ${{ matrix.target }}-${{ hashFiles('prepare_osx_build_environment.sh') }} - - name: For now remove CommandLineTools to fix build with macOS arm64 - run: sudo rm -rf /Library/Developer/CommandLineTools - name: Build xerces-c if: steps.cache.outputs.cache-hit != 'true' run: ./prepare_osx_build_environment.sh xerces ${{ matrix.target }} @@ -66,7 +64,7 @@ jobs: container: ${{ matrix.container }} strategy: matrix: - container: ['ubuntu:18.04', 'ubuntu:20.04', 'ubuntu:20.10', 'ubuntu:21.04'] + container: ['ubuntu:18.04', 'ubuntu:20.04', 'ubuntu:21.04'] env: DEBIAN_FRONTEND: noninteractive DEBFULLNAME: 'github-actions' @@ -92,7 +90,7 @@ jobs: dch --distribution $(lsb_release -cs) -v ${VERSIONEX} "Release ${VERSIONEX}." - name: Build packages run: | - dpkg-buildpackage -rfakeroot -us -uc + dpkg-buildpackage -us -uc mv ../libdigidocpp*.* . - name: Lintian run: lintian *.deb; @@ -117,7 +115,7 @@ jobs: env: MAKEFLAGS: "" VER_SUFFIX: ".VS${{ matrix.toolset }}" - VERSION: "3.14.7.${{ github.run_number }}" + VERSION: "3.14.8.${{ github.run_number }}" VCPKG_OVERLAY_TRIPLETS: "${{ github.workspace }}/patches/vcpkg-triplets" VCPKG_OVERLAY_PORTS: "${{ github.workspace }}/patches/vcpkg-ports" steps: diff --git a/libdigidocpp.dox b/libdigidocpp.dox index 84b5e9633..eb49e8485 100644 --- a/libdigidocpp.dox +++ b/libdigidocpp.dox @@ -596,6 +596,20 @@ If left unspecified then the logging output is written to standard output stream \note For testing purposes, the SK's test time-stamping service can be used. The service is available at http://demo.sk.ee/tsa/ additional information can be found at https://www.id.ee/en/rubriik/timestamping-service/. +\subsubsection VerifyService-settings Signature Verify Service settings + + + + + + + + + +
Parameter nameComments
verify.serivceUriSpecifies the URL of the signature-verify service that is used during signature validation. By default, the RIA's signature-verify service is used by the library (https://siva.eesti.ee/V3/validate) +
+ + \subsubsection pkcs11-settings PKCS#11 settings diff --git a/src/XmlConf.cpp b/src/XmlConf.cpp index 5d51f6c3d..4817d09c8 100644 --- a/src/XmlConf.cpp +++ b/src/XmlConf.cpp @@ -508,13 +508,22 @@ SET1CONST(string, setPKCS12Pass, PKCS12Pass) /** * @fn void digidoc::XmlConf::setTSUrl(const std::string &url) - * Sets a PKCS#12 certificate password. Also adds or replaces PKCS#12 certificate password in the user configuration file. + * Sets a TSA service URL. Also adds or replaces TSA service URL in the user configuration file. * * @param url Target URL to connect TSA service. - * @throws Exception exception is thrown if saving a TS URL into a user configuration file fails. + * @throws Exception exception is thrown if saving a TS service URL into a user configuration file fails. */ SET1CONST(string, setTSUrl, TSUrl) +/** + * @fn void digidoc::XmlConf::setVerifyServiceUri(const std::string &url) + * Sets a Verify service URL. Also adds or replaces Verify service URL in the user configuration file. + * + * @param url Target URL to connect Verify service. + * @throws Exception exception is thrown if saving a Verify service URL into a user configuration file fails. + */ +SET1CONST(string, setVerifyServiceUri, verifyServiceUri) + /** * @fn void digidoc::XmlConf::setPKCS12Disable( bool disable ) * Sets a PKCS#12 certificate usage. Also adds or replaces PKCS#12 certificate usage in the user configuration file. diff --git a/src/XmlConf.h b/src/XmlConf.h index 77919768e..7d7a12015 100644 --- a/src/XmlConf.h +++ b/src/XmlConf.h @@ -70,6 +70,7 @@ class DIGIDOCPP_EXPORT XmlConf: public Conf virtual void setTSLTimeOut( int timeOut ); virtual void setTSUrl(const std::string &url); + virtual void setVerifyServiceUri(const std::string &url); private: DISABLE_COPY(XmlConf); @@ -128,6 +129,7 @@ class DIGIDOCPP_EXPORT XmlConfV2: public ConfV2 virtual void setTSLTimeOut( int timeOut ); virtual void setTSUrl(const std::string &url); + virtual void setVerifyServiceUri(const std::string &url); private: DISABLE_COPY(XmlConfV2); @@ -183,6 +185,7 @@ class DIGIDOCPP_EXPORT XmlConfV3: public ConfV3 virtual void setTSLTimeOut( int timeOut ); virtual void setTSUrl(const std::string &url); + virtual void setVerifyServiceUri(const std::string &url); private: DISABLE_COPY(XmlConfV3); @@ -239,6 +242,7 @@ class DIGIDOCPP_EXPORT XmlConfV4: public ConfV4 virtual void setTSLTimeOut( int timeOut ); virtual void setTSUrl(const std::string &url); + virtual void setVerifyServiceUri(const std::string &url); private: DISABLE_COPY(XmlConfV4); diff --git a/src/libdigidocpp.i.h b/src/libdigidocpp.i.h index 5474ca05a..6c023e9a1 100644 --- a/src/libdigidocpp.i.h +++ b/src/libdigidocpp.i.h @@ -90,7 +90,6 @@ class SWIGEXPORT DigiDocConf: public digidoc::XmlConfCurrent if(!cert.empty()) serviceCerts.emplace_back(cert, X509Cert::Der); } - void setVerifyServiceUri(std::string url) { serviceUrl = std::move(url); } private: int _logLevel = 4; diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 65a527f22..b2716c0d1 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -7,6 +7,7 @@ if( Boost_INCLUDE_DIR ) add_definitions( -DDIGIDOCPPCONF="${CMAKE_SOURCE_DIR}/etc/schema" -DPKCS11_MODULE="${PKCS11_MODULE}" + -DSIVA_URL="${SIVA_URL}" ) if( LIBDIGIDOC_FOUND AND LIBDIGIDOC_LINKED ) add_definitions(-DLINKED_LIBDIGIDOC) diff --git a/test/libdigidocpp_boost.cpp b/test/libdigidocpp_boost.cpp index 5a87fa3a5..d3ff4d320 100644 --- a/test/libdigidocpp_boost.cpp +++ b/test/libdigidocpp_boost.cpp @@ -478,7 +478,7 @@ BOOST_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE(ConfSuite) BOOST_AUTO_TEST_CASE(XmlConfCase) { - XmlConf c("digidocpp.conf", util::File::path(DIGIDOCPPCONF, "/conf.xsd")); + XmlConfCurrent c("digidocpp.conf", util::File::path(DIGIDOCPPCONF, "/conf.xsd")); BOOST_CHECK_EQUAL(c.logLevel(), 2); BOOST_CHECK_EQUAL(c.logFile(), "digidocpp.log"); BOOST_CHECK_EQUAL(c.digestUri(), "http://www.w3.org/2001/04/xmlenc#sha256"); @@ -492,6 +492,10 @@ BOOST_AUTO_TEST_CASE(XmlConfCase) { BOOST_CHECK_EQUAL(c.PKCS12Pass(), "pass"); BOOST_CHECK_EQUAL(c.PKCS12Disable(), true); BOOST_CHECK_EQUAL(c.ocsp("ESTEID-SK 2007"), "http://ocsp.sk.ee"); + BOOST_CHECK_EQUAL(c.verifyServiceUri(), SIVA_URL); + const string testurl = "https://test.url"; + c.setVerifyServiceUri(testurl); + BOOST_CHECK_EQUAL(c.verifyServiceUri(), testurl); } BOOST_AUTO_TEST_SUITE_END()