diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ad3242a76..783161a4d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,7 @@ jobs: runs-on: macos-latest strategy: matrix: - target: [osx, ios, iossimulator, androidarm, androidarm64, androidx86_64] + target: [macos, iphoneos, iphonesimulator, androidarm, androidarm64, androidx86_64] steps: - name: Checkout uses: actions/checkout@v4 @@ -21,7 +21,7 @@ jobs: - name: Install dependencies run: | brew update - brew install --formula swig doxygen boost + brew install --formula ninja swig doxygen boost brew unlink python@3.11 || true brew unlink python@3.12 || true brew unlink xz @@ -48,22 +48,27 @@ jobs: - name: Setup cache run: sudo ln -s $PWD/cache/* /Library/ - name: Build macOS - if: matrix.target == 'osx' - run: ./build-library.sh test pkcs11sign zipdebug embedlibs pkgbuild + if: matrix.target == 'macos' + run: | + cmake --preset ${{ matrix.target }} -DCMAKE_BUILD_TYPE=RelWithDebInfo + cmake --build --preset ${{ matrix.target }} + cmake --build --preset ${{ matrix.target }} --target test pkcs11sign zipdebug embedlibs pkgbuild - name: Build ${{ matrix.target }} - if: matrix.target != 'osx' + if: matrix.target != 'macos' run: | - ./build-library.sh ${{ matrix.target }} install/strip + cmake --preset ${{ matrix.target }} -DCMAKE_BUILD_TYPE=RelWithDebInfo + cmake --build --preset ${{ matrix.target }} + sudo cmake --build --preset ${{ matrix.target }} --target install/strip cd /Library zip -q -r ${OLDPWD}/libdigidocpp.${{ matrix.target }}.zip libdigidocpp.* - name: Archive artifacts - if: matrix.target == 'osx' + if: matrix.target == 'macos' uses: actions/upload-artifact@v4 with: name: macOS - path: macOS/libdigidocpp*.* + path: build/macos/libdigidocpp*.* - name: Archive artifacts - if: matrix.target != 'osx' + if: matrix.target != 'macos' uses: actions/upload-artifact@v4 with: name: ${{ matrix.target }} @@ -150,7 +155,7 @@ jobs: vcvars: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Auxiliary\\Build\\vcvarsall.bat" env: VER_SUFFIX: .VS${{ matrix.toolset }} - CXXFLAGS: '/D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR' # https://github.com/actions/runner-images/issues/10004 + VCPKG_INSTALLED_DIR: ${{ github.workspace }}/vcpkg_installed steps: - name: Checkout uses: actions/checkout@v4 @@ -159,27 +164,27 @@ jobs: - name: Prepare vcpkg uses: lukka/run-vcpkg@v11 with: - vcpkgGitCommitId: 4065f37d0a6628ef17cf6ee15385f9091f1075bc + vcpkgGitCommitId: 1de2026f28ead93ff1773e6e680387643e914ea1 vcpkgJsonGlob: ./vcpkg.json runVcpkgInstall: true runVcpkgFormatString: "[`install`, `--recurse`, `--clean-after-build`, `--x-install-root`, `$[env.VCPKG_INSTALLED_DIR]`, `--triplet`, `$[env.VCPKG_DEFAULT_TRIPLET]`, `--x-feature`, `tests`]" env: VCPKG_DEFAULT_TRIPLET: ${{ matrix.platform }}-windows - VCPKG_INSTALLED_DIR: ${{ github.workspace }}/vcpkg_installed - name: Install dependencies run: choco install doxygen.install -y > $null - uses: actions/setup-python@v5 + if: matrix.platform == 'x86' with: - python-version: 3.11 - architecture: ${{ matrix.platform }} + python-version: 3.12 + architecture: x86 - name: Install WiX run: | - dotnet tool install -g wix --version 5.0.0 - wix extension -g add WixToolset.UI.wixext/5.0.0 + dotnet tool install -g wix --version 5.0.1 + wix extension -g add WixToolset.UI.wixext/5.0.1 - name: Build run: | & .\build.ps1 ` - -vcpkg_installed ${{ github.workspace }}/vcpkg_installed ` + -vcpkg_installed ${{ env.VCPKG_INSTALLED_DIR }} ` -vcvars "${{ matrix.vcvars }}" ` -platform ${{ matrix.platform }} ` -swig C:/ProgramData/chocolatey/bin/swig.exe ` @@ -269,9 +274,9 @@ jobs: - name: Build run: | cmake -B build -S . \ - -DSWIG_EXECUTABLE=NOTFOUND \ - -DBoost_INCLUDE_DIR=NOTFOUND \ - -DDOXYGEN_EXECUTABLE=NOTFOUND \ + -DCMAKE_DISABLE_FIND_PACKAGE_SWIG=YES \ + -DCMAKE_DISABLE_FIND_PACKAGE_Boost=YES \ + -DCMAKE_DISABLE_FIND_PACKAGE_Doxygen=YES \ -DBUILD_TOOLS=NO cmake --build build - name: Perform CodeQL Analysis @@ -285,7 +290,6 @@ jobs: patterns: | -src/json.hpp -src/minizip/* - -build/src/xml/* -**:cpp/poorly-documented-function -**:cpp/loop-variable-changed input: sarif-results/cpp.sarif diff --git a/CMakeLists.txt b/CMakeLists.txt index 52e7a7985..46ed99fb8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ endif() if(POLICY CMP0167) cmake_policy(SET CMP0167 NEW) endif() -project(libdigidocpp VERSION 3.18.0) +project(libdigidocpp VERSION 4.0.0) set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules) list(APPEND CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX}) diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 000000000..9d5e4479e --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,153 @@ +{ + "version": 6, + "configurePresets": [ + { + "name": "default", + "displayName": "Default config", + "description": "Default build using Ninja generator", + "generator": "Ninja", + "binaryDir": "${sourceDir}/build/${presetName}" + }, + { + "name": "base", + "displayName": "macOS base build config", + "hidden": true, + "inherits": "default", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Darwin" + }, + "environment": { + "DEST": "/Library/libdigidocpp$env{DEST_SUFFIX}" + }, + "installDir": "$env{DEST}", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_FIND_ROOT_PATH": "$env{DEST};/usr/local;/opt/homebrew" + } + }, + { + "name": "macos", + "inherits": "base", + "description": "This macos build is only available on macOS", + "cacheVariables": { + "CMAKE_OSX_ARCHITECTURES": "arm64;x86_64", + "CMAKE_OSX_DEPLOYMENT_TARGET": "12.0" + } + }, + { + "name": "mobile", + "hidden": true, + "inherits": "base", + "environment": { + "DEST_SUFFIX": ".${presetName}" + }, + "cacheVariables": { + "CMAKE_DISABLE_FIND_PACKAGE_Boost": "YES", + "CMAKE_DISABLE_FIND_PACKAGE_Doxygen": "YES", + "BUILD_TOOLS": "NO" + } + }, + { + "name": "ios", + "hidden": true, + "inherits": "mobile", + "cacheVariables": { + "CMAKE_SYSTEM_NAME": "iOS", + "CMAKE_OSX_SYSROOT": "${presetName}", + "CMAKE_OSX_DEPLOYMENT_TARGET": "15.0", + "CMAKE_OSX_ARCHITECTURES": "arm64;x86_64", + "CMAKE_DISABLE_FIND_PACKAGE_SWIG": "YES", + "FRAMEWORK_DESTINATION": "$env{DEST}/lib" + } + }, + { + "name": "iphoneos", + "inherits": "ios", + "description": "This iphoneos build is only available on macOS", + "cacheVariables": { + "CMAKE_OSX_ARCHITECTURES": "arm64" + } + }, + { + "name": "iphonesimulator", + "inherits": "ios", + "description": "This iphonesimulator build is only available on macOS" + }, + { + "name": "iphonecatalyst", + "inherits": "ios", + "description": "This iphonecatalyst build is only available on macOS", + "cacheVariables": { + "CMAKE_OSX_SYSROOT": "macosx" + } + }, + { + "name": "android", + "hidden": true, + "inherits": "mobile", + "cacheVariables": { + "CMAKE_SYSTEM_NAME": "Android", + "CMAKE_SYSTEM_VERSION": "30", + "CMAKE_DISABLE_FIND_PACKAGE_Python3": "YES", + "BUILD_SHARED_LIBS": "NO" + } + }, + { + "name": "androidarm", + "inherits": "android", + "description": "androidarm build is only available on macOS", + "cacheVariables": { + "CMAKE_ANDROID_ARCH_ABI": "armeabi-v7a" + } + }, + { + "name": "androidarm64", + "inherits": "android", + "description": "androidarm64 build is only available on macOS", + "cacheVariables": { + "CMAKE_ANDROID_ARCH_ABI": "arm64-v8a" + } + }, + { + "name": "androidx86_64", + "inherits": "android", + "description": "androidx86_64 build is only available on macOS", + "cacheVariables": { + "CMAKE_ANDROID_ARCH_ABI": "x86_64" + } + } + ], + "buildPresets": + [ + { + "name": "macos", + "configurePreset": "macos" + }, + { + "name": "iphoneos", + "configurePreset": "iphoneos" + }, + { + "name": "iphonesimulator", + "configurePreset": "iphonesimulator" + }, + { + "name": "iphonecatalyst", + "configurePreset": "iphonecatalyst" + }, + { + "name": "androidarm", + "configurePreset": "androidarm" + }, + { + "name": "androidarm64", + "configurePreset": "androidarm64" + }, + { + "name": "androidx86_64", + "configurePreset": "androidx86_64" + } + ] +} diff --git a/COPYING b/COPYING index 8759d39dc..5aa31cc36 100644 --- a/COPYING +++ b/COPYING @@ -86,41 +86,6 @@ src/crypto/signer/pkcs11.h the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -_______________________________________________________________________________ -src/xml/ generated files from xsd schemas - -Copyright (C) 2005-2010 Code Synthesis Tools CC - -This program was generated by CodeSynthesis XSD, an XML Schema to -C++ data binding compiler. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License version 2 as -published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -In addition, as a special exception, Code Synthesis Tools CC gives -permission to link this program with the Xerces-C++ library (or with -modified versions of Xerces-C++ that use the same license as Xerces-C++), -and distribute linked combinations including the two. You must obey -the GNU General Public License version 2 in all respects for all of -the code used other than Xerces-C++. If you modify this copy of the -program, you may extend this exception to your version of the program, -but you are not obligated to do so. If you do not wish to do so, delete -this exception statement from your version. - -Furthermore, Code Synthesis Tools CC makes a special exception for -the Free/Libre and Open Source Software (FLOSS) which is described -in the accompanying FLOSSE file. - _______________________________________________________________________________ examples/DigiDocCSharp diff --git a/README.md b/README.md index 2cc400e92..e6585f10d 100644 --- a/README.md +++ b/README.md @@ -16,15 +16,15 @@ 1. Install dependencies # Ubuntu - sudo apt install cmake xxd libxml-security-c-dev xsdcxx libxml2-dev libssl-dev zlib1g-dev + sudo apt install cmake libxml2-dev libxmlsec1-dev zlib1g-dev # Fedora - sudo dnf install cmake gcc-c++ openssl-devel xerces-c-devel xml-security-c-devel xsd libxml2-devel zlib-devel vim-common + sudo dnf install cmake gcc-c++ openssl-devel libxml2-devel xmlsec1-openssl-devel zlib-devel * doxygen - Optional, for API documentation * libboost-test-dev - Optional, for unittests * swig - Optional, for C#, Java and python bindings - * libpython3-dev, python3-distutils - Optional, for python bindings - * openjdk-8-jdk-headless - Optional, for Java bindings + * libpython3-dev, python3-setuptools - Optional, for python bindings + * openjdk-17-jdk-headless - Optional, for Java bindings 2. Fetch the source @@ -59,23 +59,24 @@ git clone --recursive https://github.com/open-eid/libdigidocpp cd libdigidocpp -3. Prepare dependencies (available targets: osx, ios, iossimulator, androidarm, androidarm64, androidx86_64) +3. Prepare dependencies (available targets: macos, iphoneos, iphonesimulator, androidarm, androidarm64, androidx86_64) - sh prepare_osx_build_environment.sh osx all + sh prepare_osx_build_environment.sh macos all 4. Install dependencies - brew install xsd - brew unlink xerces-c + brew install pkg-config ninja * doxygen - Optional, for API documentation * boost - Optional, for unittests * swig - Optional, for C# and Java bindings * openjdk - Optional, for Java bindings -5. Configure, build and install (available targets: osx, ios, iossimulator, androidarm, androidarm64, androidx86_64) +5. Configure, build and install (available presets: macos, iphoneos, iphonessimulator, androidarm, androidarm64, androidx86_64) - ./build-library.sh osx install + cmake --preset macos + cmake --build --preset macos + sudo cmake --build --preset macos --target install 6. Execute @@ -84,7 +85,7 @@ ### Windows 1. Install dependencies and necessary tools from - * [Visual Studio Community 2017/2019/2022](https://www.visualstudio.com/downloads/) + * [Visual Studio Community 2019/2022](https://www.visualstudio.com/downloads/) * [CMake](http://www.cmake.org) * [vcpkg](https://vcpkg.io/) * [Swig](http://swig.org/download.html) - Optional, for C# and Java bindings @@ -102,37 +103,32 @@ git clone --recursive https://github.com/open-eid/libdigidocpp cd libdigidocpp -3. Prepare - - powershell -ExecutionPolicy ByPass -File prepare_win_build_environment.ps1 -toolset 142 - -4. Configure +3. Configure cmake -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake ` - -DVCPKG_TARGET_TRIPLET=x64-windows-v142 ` + -DVCPKG_TARGET_TRIPLET=x64-windows ` -DVCPKG_MANIFEST_FEATURES=tests ` - -DXSD_ROOT=xsd/libxsd ` -B build -S . Optional CMake parameters: - -DSWIG_EXECUTABLE=C:/swigwin-4.1.1/swig.exe + -DSWIG_EXECUTABLE=C:/swigwin-4.2.1/swig.exe After running the cmake build, digidoc_csharp.dll along with the C# source files will be created, more info at [examples/DigiDocCSharp/README.md](examples/DigiDocCSharp/README.md). -5. Build +4. Build cmake --build build -6. Alternative to steps 4. and 5. - +5. Alternative to steps 4. and 5. - - powershell -ExecutionPolicy ByPass -File build.ps1 -toolset 142 + powershell -ExecutionPolicy ByPass -File build.ps1 -platform x64 - The build script builds executables and installation media for all - platforms (x86 and x64 / Debug and Release with debug symbols) + The build script builds executables and installation media for given + platform (Debug and Release with debug symbols) -7. Execute +6. Execute build/src/digidoc-tool.exe diff --git a/build-library.sh b/build-library.sh deleted file mode 100755 index 044b2cdc6..000000000 --- a/build-library.sh +++ /dev/null @@ -1,106 +0,0 @@ -#!/bin/bash - -set -e - -if [ "$#" -eq 0 ]; then - echo "Usage:" - echo " $0 target [maketask]" - echo " target: osx ios iossimulator ioscatalyst androidarm androidarm64 androidx86_64" - echo "To control iOS, macOS builds set environment variables:" - echo " minimum deployment target" - echo " - MACOSX_DEPLOYMENT_TARGET=12.0" - echo " - IPHONEOS_DEPLOYMENT_TARGET=15.0" - echo " archs to build on macOS/iOS" - echo " - ARCHS=\"arm64 x86_64\" (macOS)" - echo " - ARCHS=\"arm64\" (iOS)" - echo " - ARCHS=\"arm64 x86_64\" (iPhoneSimulator)" - exit -fi - -case "$@" in -*android*) - case "$@" in - *x86_64*) - TARGET=androidx86_64 - ARCH="x86_64" - ;; - *arm64*) - TARGET=androidarm64 - ARCH="arm64-v8a" - ;; - *) - TARGET=androidarm - ARCH="armeabi-v7a" - ;; - esac - : ${ANDROID_NDK_HOME:=$(ls -d /Volumes/android-ndk-r*/AndroidNDK*.app/Contents/NDK)} - TARGET_PATH=/Library/libdigidocpp.${TARGET} - CMAKEARGS=" - -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake \ - -DANDROID_PLATFORM=30 \ - -DANDROID_ABI=${ARCH} \ - -DCMAKE_DISABLE_FIND_PACKAGE_Boost=YES \ - -DCMAKE_DISABLE_FIND_PACKAGE_Doxygen=YES \ - -DBUILD_TOOLS=NO \ - -DBUILD_SHARED_LIBS=NO" - ;; -*ios*) - : ${IPHONEOS_DEPLOYMENT_TARGET:="15.0"} - export IPHONEOS_DEPLOYMENT_TARGET - case "$@" in - *simulator*) - echo "Building for iOS Simulator" - TARGET=iphonesimulator - CMAKEARGS="-DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_SYSTEM_NAME=iOS" - : ${ARCHS:="arm64 x86_64"} - ;; - *catalyst*) - echo "Building for iOS macOS Catalyst" - TARGET=iphonecatalyst - CMAKEARGS="-DCMAKE_OSX_SYSROOT=macosx" - export CFLAGS="-target x86_64-apple-ios${IPHONEOS_DEPLOYMENT_TARGET}-macabi" - export CXXFLAGS="-target x86_64-apple-ios${IPHONEOS_DEPLOYMENT_TARGET}-macabi" - : ${ARCHS:="arm64 x86_64"} - ;; - *) - echo "Building for iOS" - TARGET=iphoneos - CMAKEARGS="-DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_SYSTEM_NAME=iOS" - : ${ARCHS:="arm64"} - ;; - esac - TARGET_PATH=/Library/libdigidocpp.${TARGET} - CMAKEARGS="${CMAKEARGS} \ - -DCMAKE_OSX_DEPLOYMENT_TARGET=${IPHONEOS_DEPLOYMENT_TARGET} \ - -DCMAKE_DISABLE_FIND_PACKAGE_SWIG=YES \ - -DCMAKE_DISABLE_FIND_PACKAGE_Boost=YES \ - -DCMAKE_DISABLE_FIND_PACKAGE_Doxygen=YES \ - -DFRAMEWORK_DESTINATION=${TARGET_PATH}/lib - -DBUILD_TOOLS=NO" - ;; -*) - echo "Building for macOS" - TARGET=macOS - TARGET_PATH=/Library/libdigidocpp - : ${ARCHS:="arm64 x86_64"} - : ${MACOSX_DEPLOYMENT_TARGET:="12.0"} - export MACOSX_DEPLOYMENT_TARGET -esac - -cmake --fresh -B ${TARGET} -S . \ - -DCMAKE_BUILD_TYPE=RelWithDebInfo \ - -DCMAKE_INSTALL_PREFIX=${TARGET_PATH} \ - -DCMAKE_OSX_ARCHITECTURES="${ARCHS// /;}" \ - -DCMAKE_FIND_ROOT_PATH="${TARGET_PATH};/usr/local;/opt/homebrew" \ - -DOPENSSL_ROOT_DIR=${TARGET_PATH} \ - ${CMAKEARGS} -cmake --build ${TARGET} - -while test $# -gt 0; do - case "$1" in - android*|*ios*|*mac*|*osx*) ;; - install*) sudo cmake --build ${TARGET} --target $1 ;; - *) cmake --build ${TARGET} --target $1 ;; - esac - shift -done diff --git a/build.ps1 b/build.ps1 index b6228e74a..e444888e9 100644 --- a/build.ps1 +++ b/build.ps1 @@ -1,9 +1,11 @@ #powershell -ExecutionPolicy ByPass -File build.ps1 param( [string]$libdigidocpp = $PSScriptRoot, + [string]$git = "git.exe", [string]$vcpkg = "vcpkg\vcpkg.exe", [string]$vcpkg_dir = (split-path -parent $vcpkg), [string]$vcpkg_installed = $libdigidocpp, + [string]$vcpkg_installed_platform = "$vcpkg_installed\vcpkg_installed_$platform", [string]$build_number = $(if ($null -eq $env:BUILD_NUMBER) {"0"} else {$env:BUILD_NUMBER}), [string]$msiversion = "3.18.0.$build_number", [string]$platform = "x64", @@ -18,6 +20,20 @@ param( [string]$sign = $null ) +Try { + & $wix > $null +} +Catch { + & dotnet tool install --global --version 5.0.1 wix + & $wix extension add -g WixToolset.UI.wixext/5.0.1 +} + +if(!(Test-Path -Path $vcpkg)) { + & $git clone https://github.com/microsoft/vcpkg $vcpkg_dir + & $vcpkg_dir\bootstrap-vcpkg.bat + & $vcpkg install --clean-after-build --triplet x64-windows --x-feature=tests --x-install-root=$vcpkg_installed_platform +} + $cmakeext = @() $wixext = @() $target = @("all") @@ -41,7 +57,7 @@ foreach($type in @("Debug", "RelWithDebInfo")) { "-DCMAKE_INSTALL_PREFIX=$platform" ` "-DCMAKE_INSTALL_LIBDIR=bin" ` "-DCMAKE_TOOLCHAIN_FILE=$vcpkg_dir/scripts/buildsystems/vcpkg.cmake" ` - "-DVCPKG_INSTALLED_DIR=$vcpkg_installed\vcpkg_installed_$platform" ` + "-DVCPKG_INSTALLED_DIR=$vcpkg_installed_platform" ` "-DSIGNCERT=$sign" ` $cmakeext "&&" $cmake --build $buildpath --target $target "&&" $cmake --install $buildpath } @@ -52,7 +68,7 @@ foreach($type in @("Debug", "RelWithDebInfo")) { -bv "WixUIDialogBmp=$libdigidocpp/cmake/modules/dlgbmp.bmp" ` -d "ICON=$libdigidocpp/cmake/modules/ID.ico" ` -d "MSI_VERSION=$msiversion" ` - -d "vcpkg=$vcpkg_installed/vcpkg_installed_$platform/$platform-windows" ` + -d "vcpkg=$vcpkg_installed_platform/$platform-windows" ` -d "libdigidocpp=$(Get-Location)/$platform" ` $libdigidocpp\libdigidocpp.wxs diff --git a/cmake b/cmake index f2f2e074c..057c95e36 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit f2f2e074cd85388f062c1f68ceeb93d0323bb7f7 +Subproject commit 057c95e365c9d018bd15afe0dc03ab4122b4147b diff --git a/libdigidocpp.dox b/libdigidocpp.dox index f73724789..3e9d3b2ec 100644 --- a/libdigidocpp.dox +++ b/libdigidocpp.dox @@ -39,7 +39,7 @@ The following chapters provides an overview of ASiC-E (XAdES) digitally signed f \subsubsection container ASiC-E (XAdES) container format -The ETSI standard \ref ASiC "EN 319 162-1" called Associated Signature Containers (ASiC) defines format of container for encapsulation of signed files and signatures with extra information. The container type used in case of ASiC-E documents is Associated Signature Extended form. In the container \ref XAdES_EN "XAdES EN 319 132-1" (XML Advanced Electronic Signatures) format signatures are used. +The ETSI standard \ref ASiC "EN 319 162-1" called Associated Signature Containers (ASiC) defines format of container for encapsulation of signed files and signatures with extra information. The container type used in case of ASiC-E documents is Associated Signature Extended form. In the container \ref XAdES "XAdES EN 319 132-1" (XML Advanced Electronic Signatures) format signatures are used. ASiC-E container is a ZIP file consisting of the following objects: - a file named "mimetype", containing only the following value: application/vnd.etsi.asic-e+zip @@ -59,7 +59,7 @@ Original files (which were signed) along with the signature(s), timestamp(s), va \subsubsection profiles Legacy BDOC signature profiles -The format of the BDOC 2.1 digitally signed file is based on ETSI \ref XAdES "XAdES TS 101 903" standard. The XAdES standard defines formats for advanced electronic signatures that remain valid over long periods of time. The ETSI standard \ref XAdES-BP "TS 103 171" "XAdES Baseline Profile" further profiles the XAdES signature by putting limitations on choices. +The format of the BDOC 2.1 digitally signed file is based on ETSI \ref XAdES "XAdES TS 101 903" standard. The XAdES standard defines formats for advanced electronic signatures that remain valid over long periods of time. The ETSI standard \ref XAdES "TS 103 171" "XAdES Baseline Profile" further profiles the XAdES signature by putting limitations on choices. BDOC 2.1 specification defines two profiles of qualified BDOC signatures: BDOC with time-mark and BDOC with time-stamp. Both of the profiles offer long-term validation possibility by incorporating the necessary validation data in the signature. Both of the profiles are compliant to XAdES LT-Level requirements. @@ -154,22 +154,13 @@ XML Signature Syntax and Processing. Version 1.1 http://www.w3.org/TR/xmldsig-core1/ \anchor XAdES XAdES -ETSI TS 101 903 V1.4.2 (2010-12) – XML Advanced Electronic Signatures - -http://www.etsi.org/deliver/etsi_ts/101900_101999/101903/01.04.02_60/ts_101903v010402p.pdf
-Other versions:
-http://www.etsi.org/deliver/etsi_ts/101900_101999/101903/01.04.01_60/ts_101903v010401p.pdf
-http://www.etsi.org/deliver/etsi_ts/101900_101999/101903/01.03.02_60/ts_101903v010302p.pdf -\anchor XAdES-BP XAdES Baseline Profile +ETSI EN 319 132-1 V1.3.1 (2024-07) - Building blocks and XAdES baseline signatures
+ETSI TS 101 903 V1.4.2 (2010-12) – XML Advanced Electronic Signatures
ETSI TS 103 171 V2.1.1 (2012-03) - XAdES Baseline Profile +https://www.etsi.org/deliver/etsi_en/319100_319199/31913201/01.03.01_60/en_31913201v010301p.pdf
+http://www.etsi.org/deliver/etsi_ts/101900_101999/101903/01.04.02_60/ts_101903v010402p.pdf
http://www.etsi.org/deliver/etsi_ts/103100_103199/103171/02.01.01_60/ts_103171v020101p.pdf -\anchor XAdES_EN XAdES EN -ETSI EN 319 132-1 V1.2.1 (2022-02) - Building blocks and XAdES baseline signatures - -https://www.etsi.org/deliver/etsi_en/319100_319199/31913201/01.02.01_60/en_31913201v010201p.pdf
-Other versions:
-http://www.etsi.org/deliver/etsi_en/319100_319199/31913201/01.01.01_60/en_31913201v010101p.pdf \anchor XAdES-Validation XAdES Validation ETSI TS 102 853 V1.1.2 (2012-10) – Signature validation procedures and policies @@ -189,19 +180,13 @@ http://docs.oasis-open.org/office/v1.2/cs01/OpenDocument-v1.2-cs01-part3.html#__ Other versions:
http://docs.oasis-open.org/office/v1.0/OpenDocument-v1.0-os.pdf \anchor ASiC ASiC -ETSI EN 319 162-1 V1.1.1 (2016-04) - Associated Signature Containers +ETSI EN 319 162-1 V1.1.1 (2016-04) - Associated Signature Containers
+ETSI TS 102 918 V1.3.1 (2013-06) - Associated Signature Containers
+ETSI TS 103 174 V2.1.1 (2012-03) - ASiC Baseline Profile http://www.etsi.org/deliver/etsi_en/319100_319199/31916201/01.01.01_60/en_31916201v010101p.pdf
-Other versions:
http://www.etsi.org/deliver/etsi_ts/102900_102999/102918/01.03.01_60/ts_102918v010301p.pdf
-http://www.etsi.org/deliver/etsi_ts/102900_102999/102918/01.01.01_60/ts_102918v010101p.pdf
-http://www.etsi.org/deliver/etsi_ts/102900_102999/102918/01.02.01_60/ts_102918v010201p.pdf -\anchor ASiC-BP ASiC Baseline Profile -ETSI TS 103 174 V2.1.1 (2012-03) - -http://www.etsi.org/deliver/etsi_ts/103100_103199/103174/02.02.01_60/ts_103174v020201p.pdf
-Other versions:
-http://www.etsi.org/deliver/etsi_ts/103100_103199/103174/02.01.01_60/ts_103174v020101p.pdf +http://www.etsi.org/deliver/etsi_ts/103100_103199/103174/02.02.01_60/ts_103174v020201p.pdf \anchor PDF PDF (\anchor PAdES PAdES) ETSI EN 319 142-1 V1.1.1 (2016-04) - PAdES digital signatures @@ -219,12 +204,9 @@ Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation http://tools.ietf.org/html/rfc5280 \anchor TSL Trusted Lists -ETSI TS 119 612 V1.1.1 (2013-06) +ETSI TS 119 612 V2.2.1 (2016-04) -http://www.etsi.org/deliver/etsi_ts/119600_119699/119612/02.02.01_60/ts_119612v020201p.pdf
-Other versions:
-http://www.etsi.org/deliver/etsi_ts/119600_119699/119612/01.01.01_60/ts_119612v010101p.pdf
-http://www.etsi.org/deliver/etsi_ts/102200_102299/102231/03.01.02_60/ts_102231v030102p.pdf +https://www.etsi.org/deliver/etsi_ts/119600_119699/119612/02.02.01_60/ts_119612v020201p.pdf \anchor SiVa SiVa Digital signature validation web service that provides SOAP and JSON API to validate files @@ -375,10 +357,8 @@ Libdigidocpp library depends on the software libraries listed below. - - - - + + @@ -395,10 +375,10 @@ Several XML schemas are used when creating digitally signed documents in BDOC 2.
Base ComponentRequired/optionalDescription
OpenSSLrequiredUsed for validating certificates and digest values.
XercesCrequiredUsed for validating the documents according to XML Schema, reading and writing XML.
XalanCrequiredUsed for handling XPath references in XML
XmlSecurityCrequiredUsed for handling signature related components.
XSDrequiredUsed for dynamically generating C++ source code according to XML Schemas, only used during building process of the library. Required when building the library from source code.
libxml2requiredUsed for validating the documents according to XML Schema, reading and writing XML.
xmlsecrequiredUsed for handling signature related components.
ZLIBrequiredUsed when compressing and extracting ASiC files in ZIP format.
MiniziprequiredUsed when creating and opening ZIP container for BDOC file. If the component is not found from system then bundled version with source code is used. Forms a part of ZLIB component.
PKCS11optionalUsed for searching for default PKCS#11 driver in the system so that its path could be registered in configuration entries.
-
Schema fileDescription
OpenDocument_manifest.xsdOASIS OpenDocument v1.0 (\ref OpenDocument "OpenDocument") -Defines the structure of META-INF/manifest.xml file in BDOC container. -https://www.oasis-open.org/committees/download.php/12570/OpenDocument-manifest-schema-v1.0-os.rng -
OpenDocument_dsig.xsdOASIS OpenDocument v1.0 (\ref OpenDocument "OpenDocument") +
OpenDocument_manifest.xsdOASIS OpenDocument v1.2 (\ref OpenDocument "OpenDocument") +Defines the structure of META-INF/manifest.xml file in ASiC container. +https://docs.oasis-open.org/office/v1.2/csd06/OpenDocument-v1.2-csd06-manifest-schema.rng +
OpenDocument_dsig.xsdOASIS OpenDocument v1.2 (\ref OpenDocument "OpenDocument") Defines the structure of META-INF/signature.xml file in ADOC container. https://docs.oasis-open.org/office/v1.2/csd06/OpenDocument-v1.2-csd06-dsig-schema.rng
en_31916201v010101.xsdAssociated Signature Containers (\ref ASiC "ASiC") @@ -406,12 +386,10 @@ Defines the format of container for encapsulating the signed documents, signatur
xmldsig-core-schema.xsdXML Signature Core Schema Instance (\ref XML-DSIG "XML-DSIG") Defines XML syntax for digital signatures. http://www.w3.org/TR/2008/REC-xmldsig-core-20080610/xmldsig-core-schema.xsd -
XAdES01903v132-201601.xsdXML Advanced Electronic Signatures (\ref XAdES_EN "XAdES EN") +
XAdES01903v132-201601.xsdXML Advanced Electronic Signatures (\ref XAdES "XAdES EN") Defines a set of extensions to XML-DSIG making it suitable for advanced electronic signature. http://uri.etsi.org/01903/v1.3.2/XAdES01903v132-201601.xsd -
XAdES01903v132-201601-relaxed.xsdRelaxed version of XML Advanced Electronic Signatures (\ref XAdES_EN "XAdES EN") -Allows to list child elements of the SignatureProductionPlace element in any sequence. Schema is used when validating the BDOC documents in order to accept documents produced by DigiDoc4j library version 1.0.3 and earlier. -
XAdES01903v141-201601.xsdDefines XML syntax for additional elements of XAdES signatures that were added with version 1.4.1 of the (\ref XAdES_EN "XAdES EN") standard. Needed for implementing archive time-stamp support in the future. +
XAdES01903v141-201601.xsdDefines XML syntax for additional elements of XAdES signatures that were added with version 1.4.1 of the (\ref XAdES "XAdES EN") standard. Needed for implementing archive time-stamp support in the future. http://uri.etsi.org/01903/v1.4.1/XAdES01903v141-201601.xsd
ts_119612v020201_201601xsd.xsd
ts_119612v020101_additionaltypes_xsd.xsd
ts_119612v020101_sie_xsd.xsd
Defines the format of Trust Service status Lists (\ref TSL) that contain information about trusted CA, OCSP and TSA certificates.
conf.xsdConfiguration properties’ schema. Defines the Libdigidocpp configuration file’s digidocpp.conf structure (see also \ref conf). @@ -430,8 +408,13 @@ Modifications are marked between xml comment tags. 1) The schema’s location has been altered so that the imported schema file is looked up from the local file system. \code{.xml} - + + +\endcode +2) Additional schema’s location imports has been added so that the imported schema file is looked up from the local file system. +\code{.xml} + + \endcode Schema xmldsig-core-schema.xsd @@ -464,8 +447,8 @@ schemaLocation="xmldsig-core-schema.xsd"/> + + \endcode 2) The "type" attribute has been added, otherwise a warning message would be produced. \code{.xml} @@ -491,18 +474,32 @@ schemaLocation="xmldsig-core-schema.xsd"/> + + \endcode Schema ts_119612v020201_201601xsd.xsd 1) The schemas' locations have been modified so that the file is looked up from the local file system. \code{.xml} - - + + + + \endcode diff --git a/prepare_osx_build_environment.sh b/prepare_osx_build_environment.sh index 643bec77b..ee49e3fa4 100755 --- a/prepare_osx_build_environment.sh +++ b/prepare_osx_build_environment.sh @@ -2,7 +2,7 @@ set -e OPENSSL_DIR=openssl-3.0.14 -LIBXML2_DIR=libxml2-2.12.8 +LIBXML2_DIR=libxml2-2.12.9 XMLSEC_DIR=xmlsec1-1.3.5 ANDROID_NDK=android-ndk-r26d FREETYPE_DIR=freetype-2.10.1 @@ -63,7 +63,7 @@ case "$@" in export IPHONEOS_DEPLOYMENT_TARGET export CFLAGS="-arch ${ARCHS// / -arch } -isysroot ${SYSROOT}" ;; -*ioscatalyst*) +*iphonecatalyst*) echo "Building for iOS macOS Catalyst" TARGET_PATH=/Library/libdigidocpp.iphonecatalyst CONFIGURE="--host=aarch64-apple-darwin --enable-static --disable-shared --disable-dependency-tracking" @@ -73,7 +73,7 @@ case "$@" in export IPHONEOS_DEPLOYMENT_TARGET export CFLAGS="-arch ${ARCHS// / -arch } -target x86_64-apple-ios${IPHONEOS_DEPLOYMENT_TARGET}-macabi -isysroot ${SYSROOT}" ;; -*ios*) +*iphoneos*) echo "Building for iOS" TARGET_PATH=/Library/libdigidocpp.iphoneos CONFIGURE="--host=aarch64-apple-darwin --enable-static --disable-shared --disable-dependency-tracking" @@ -84,7 +84,7 @@ case "$@" in export CFLAGS="-arch ${ARCHS// / -arch } -isysroot ${SYSROOT}" ;; *) - echo "Building for OSX" + echo "Building for macOS" TARGET_PATH=/Library/libdigidocpp CONFIGURE="--disable-static --enable-shared --disable-dependency-tracking" SYSROOT=$(xcrun -sdk macosx --show-sdk-path) @@ -131,7 +131,7 @@ function xmlsec { patch -Np1 -i ../vcpkg-ports/xmlsec/xmlsec1-1.3.5.legacy.patch case "${ARGS}" in *android*) CONF_EXTRA="--without-libxslt --with-libxml=${TARGET_PATH}" ;; - *ios*) CONF_EXTRA="--without-libxslt" ;; + *iphone*) CONF_EXTRA="--without-libxslt" ;; *) ;; esac ./configure --prefix=${TARGET_PATH} ${CONFIGURE} ${CONF_EXTRA} \ @@ -169,7 +169,7 @@ function openssl { case "${ARGS}" in *simulator*) CC="" CFLAGS="-arch ${ARCH}" ./Configure iossimulator-xcrun --prefix=${TARGET_PATH} no-shared no-dso no-module no-engine no-tests no-ui-console enable-ec_nistp_64_gcc_128 ;; *catalyst*) CC="" CFLAGS="-target ${ARCH}-apple-ios-macabi" ./Configure darwin64-${ARCH} --prefix=${TARGET_PATH} no-shared no-dso no-module no-engine no-tests no-ui-console enable-ec_nistp_64_gcc_128 ;; - *ios*) CC="" CFLAGS="" ./Configure ios64-xcrun --prefix=${TARGET_PATH} no-shared no-dso no-module no-engine no-tests no-ui-console enable-ec_nistp_64_gcc_128 ;; + *iphone*) CC="" CFLAGS="" ./Configure ios64-xcrun --prefix=${TARGET_PATH} no-shared no-dso no-module no-engine no-tests no-ui-console enable-ec_nistp_64_gcc_128 ;; *) CC="" CFLAGS="" ./Configure darwin64-${ARCH} --prefix=${TARGET_PATH} shared no-module no-tests enable-ec_nistp_64_gcc_128 esac make -s > /dev/null @@ -259,7 +259,7 @@ function podofo { -DZLIB_INCLUDE_DIR=${SYSROOT}/usr/include -DZLIB_LIBRARY=${SYSROOT}/usr/lib/libz.so" ;; - *ios*|*simulator*) + *iphone*) PARAMS="-DLIBCRYPTO_LIBRARY_RELEASE=${TARGET_PATH}/lib/libcrypto.a -DPODOFO_BUILD_STATIC=YES -DPODOFO_BUILD_SHARED=NO @@ -318,7 +318,7 @@ case "$@" in *) echo "Usage:" echo " $0 [target] [task]" - echo " target: osx ios iossimulator ioscatalyst androidarm androidarm64 androidx86_64" + echo " target: osx iphoneos iphonesimulator iphonecatalyst androidarm androidarm64 androidx86_64" echo " tasks: openssl, libxml2, xmlsec, all, help" echo "To control iOS, macOS builds set environment variables:" echo " minimum deployment target" diff --git a/prepare_win_build_environment.ps1 b/prepare_win_build_environment.ps1 deleted file mode 100644 index f9d108421..000000000 --- a/prepare_win_build_environment.ps1 +++ /dev/null @@ -1,23 +0,0 @@ -#powershell -ExecutionPolicy ByPass -File prepare_win_build_environment.ps1 [-dependencies] [-xsd] -param( - [string]$vcpkg = "vcpkg\vcpkg.exe", - [string]$git = "git.exe", - [switch]$wix = $false, - [switch]$dependencies = $false -) - -if($wix) { - & dotnet tool install --global wix - & wix extension add -g WixToolset.UI.wixext/4.0.4 -} - -if($dependencies) { - if(!(Test-Path -Path $vcpkg)) { - $vcpkg_dir = (split-path -parent $vcpkg) - & $git clone --depth 1 https://github.com/microsoft/vcpkg $vcpkg_dir - & $vcpkg_dir\bootstrap-vcpkg.bat - } - & $vcpkg install --clean-after-build --triplet x86-windows --x-feature=tests --x-install-root=vcpkg_installed_x86 - & $vcpkg install --clean-after-build --triplet x64-windows --x-feature=tests --x-install-root=vcpkg_installed_x64 -} - diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 83d66a469..9a9b346b0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -138,6 +138,7 @@ set_target_properties(digidocpp PROPERTIES MACOSX_FRAMEWORK_IDENTIFIER "ee.ria.digidocpp" MACOSX_RPATH YES COMPILE_DEFINITIONS TARGET_NAME="$" + POSITION_INDEPENDENT_CODE YES ) target_include_directories(digidocpp PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) @@ -318,7 +319,7 @@ if( FRAMEWORK ) COMMAND touch $ $<$:$> ) add_custom_target(pkgbuild DEPENDS digidocpp $ - COMMAND make install DESTDIR=install + COMMAND DESTDIR=install ${CMAKE_COMMAND} --install . COMMAND pkgbuild --root install "$<$:--sign;${SIGNCERT}>" ${CMAKE_BINARY_DIR}/libdigidocpp_${VERSION}$ENV{VER_SUFFIX}.pkg COMMAND_EXPAND_LISTS diff --git a/vcpkg-ports/openssl/windows/portfile.cmake b/vcpkg-ports/openssl/windows/portfile.cmake index d35f30972..1155b1202 100644 --- a/vcpkg-ports/openssl/windows/portfile.cmake +++ b/vcpkg-ports/openssl/windows/portfile.cmake @@ -22,7 +22,7 @@ elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") elseif(VCPKG_DETECTED_CMAKE_C_COMPILER_ID MATCHES "Clang") set(OPENSSL_ARCH VC-CLANG-WIN64-CLANGASM-ARM) else() - set(OPENSSL_ARCH VC-WIN64-CLANGASM-ARM) + set(OPENSSL_ARCH VC-WIN64-ARM) endif() else() message(FATAL_ERROR "Unsupported target architecture: ${VCPKG_TARGET_ARCHITECTURE}") diff --git a/vcpkg.json b/vcpkg.json index f217378e7..36c5b76f9 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -12,7 +12,7 @@ "features": { "tests": { "description": "Build tests", "dependencies": ["boost-test"] } }, - "builtin-baseline": "4065f37d0a6628ef17cf6ee15385f9091f1075bc", + "builtin-baseline": "1de2026f28ead93ff1773e6e680387643e914ea1", "vcpkg-configuration": { "overlay-ports": [ "vcpkg-ports/openssl",