Skip to content

Commit

Permalink
Add option to save SiVa URL to xml config
Browse files Browse the repository at this point in the history
IB-6839

Signed-off-by: Raul Metsma <raul@metsma.ee>
  • Loading branch information
metsma committed Oct 1, 2021
1 parent b42174f commit 41335c5
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 10 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,14 @@ 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
id: cache
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 }}
Expand Down Expand Up @@ -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'
Expand All @@ -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;
Expand All @@ -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:
Expand Down
14 changes: 14 additions & 0 deletions libdigidocpp.dox
Original file line number Diff line number Diff line change
Expand Up @@ -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
<table>
<tr>
<th>Parameter name</th>
<th>Comments</th>
</tr>
<tr>
<td>verify.serivceUri</td>
<td>Specifies 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)
</td>
</tr>
</table>


\subsubsection pkcs11-settings PKCS#11 settings
<table>
<tr>
Expand Down
13 changes: 11 additions & 2 deletions src/XmlConf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions src/XmlConf.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion src/libdigidocpp.i.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 5 additions & 1 deletion test/libdigidocpp_boost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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()

Expand Down

0 comments on commit 41335c5

Please sign in to comment.