Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ jobs:
steps:
- name: Install dependencies
run: |
for f in /etc/apt/sources.list /etc/apt/sources.list.d/*.list /etc/apt/sources.list.d/*.sources; do
[ -f "$f" ] && sed -i 's|http://archive.ubuntu.com|http://azure.archive.ubuntu.com|g; s|http://security.ubuntu.com|http://azure.archive.ubuntu.com|g' "$f"
done
echo 'path-exclude=/usr/share/man/*' > /etc/dpkg/dpkg.cfg.d/99-nodocs
echo 'path-exclude=/usr/share/doc/*' >> /etc/dpkg/dpkg.cfg.d/99-nodocs
echo 'path-exclude=/usr/share/doc-base/*' >> /etc/dpkg/dpkg.cfg.d/99-nodocs
Expand Down Expand Up @@ -136,7 +139,7 @@ jobs:
key: vcpkg-${{ matrix.image }}-${{ matrix.platform }}-${{ hashFiles('vcpkg.json') }}
- name: Install dependencies
run: winget install --silent --accept-source-agreements --accept-package-agreements swig doxygen
- uses: actions/setup-java@v4
- uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: '17'
Expand Down
20 changes: 11 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,21 @@ set(CMAKE_VISIBILITY_INLINES_HIDDEN YES)
set(BUILD_TOOLS YES CACHE BOOL "Build cdoc-tool" )
set(BUILD_SHARED_LIBS YES CACHE BOOL "Build library as SHARED or STATIC")
set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Adds a postfix for debug-built libraries.")
set(CPACK_PACKAGE_VERSION ${VERSION})
set(CPACK_GENERATOR RPM)
set(CPACK_PACKAGE_CONTACT "RIA <info@ria.ee>")
set(CPACK_PACKAGE_VENDOR RIA)
set(CPACK_PACKAGING_INSTALL_PREFIX /usr)
list(APPEND CPACK_RPM_RELOCATION_PATHS ${CMAKE_INSTALL_SYSCONFDIR})
set(CPACK_RPM_FILE_NAME RPM-DEFAULT)
set(CPACK_RPM_PACKAGE_RELEASE_DIST ON)
if(APPLE)
set(FRAMEWORK YES CACHE BOOL "Build library as Mac OS X Framework")
set(FRAMEWORK_DESTINATION /Library/Frameworks CACHE PATH "Mac OS X Framework install destination")
endif()
include(CPack)
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
set(CPACK_PACKAGE_VERSION ${VERSION})
set(CPACK_GENERATOR RPM)
set(CPACK_PACKAGE_CONTACT "RIA <info@ria.ee>")
set(CPACK_PACKAGE_VENDOR RIA)
set(CPACK_PACKAGING_INSTALL_PREFIX /usr)
list(APPEND CPACK_RPM_RELOCATION_PATHS ${CMAKE_INSTALL_SYSCONFDIR})
set(CPACK_RPM_FILE_NAME RPM-DEFAULT)
set(CPACK_RPM_PACKAGE_RELEASE_DIST ON)
include(CPack)
endif()
include(GNUInstallDirs)

option(LIBCDOC_WITH_DOCS "Generate documentation with Doxygen" ON)
Expand Down
2 changes: 2 additions & 0 deletions cdoc/Lock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ Lock::parseLabel(const std::string& label)
}

auto range_to_sv = [](auto range) constexpr {
if (range.empty())
return std::string_view();
return std::string_view(&*range.begin(), std::ranges::distance(range));
};
for (const auto &part : std::ranges::split_view(label_to_prcss, '&'))
Expand Down
3 changes: 1 addition & 2 deletions etc/Doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -955,8 +955,7 @@ INPUT = @PROJECT_SOURCE_DIR@/cdoc/CDoc.h \
@PROJECT_SOURCE_DIR@/cdoc/NetworkBackend.h \
@PROJECT_SOURCE_DIR@/cdoc/PKCS11Backend.h \
@PROJECT_SOURCE_DIR@/cdoc/WinBackend.h \
@PROJECT_SOURCE_DIR@/cdoc/ILogger.h \
@PROJECT_SOURCE_DIR@/cdoc/ConsoleLogger.h \
@PROJECT_SOURCE_DIR@/cdoc/Logger.h \
@PROJECT_SOURCE_DIR@/doc/intro.md \
@PROJECT_SOURCE_DIR@/doc/overview.md \
@PROJECT_SOURCE_DIR@/doc/usage.md \
Expand Down
4 changes: 2 additions & 2 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
add_executable(unittests
libcdoc_boost.cpp
../cdoc/CDocCipher.cpp
../cdoc/Crypto.cpp)
../cdoc/Crypto.cpp
)

target_link_libraries(unittests
OpenSSL::SSL
Expand Down
8 changes: 7 additions & 1 deletion test/libcdoc_boost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ const map<string, string> ExpectedParsedLabel {
{"cn", "JÕEORG,JAAK-KRISTJAN,38001085718"}
};

static string decodeName(fs::path path)
{
auto name = path.u8string();
return {reinterpret_cast<const char*>(name.data()), name.size()};
}

/**
* @brief The base class for Test Fixtures.
*/
Expand Down Expand Up @@ -529,7 +535,7 @@ BOOST_FIXTURE_TEST_CASE_WITH_DECOR(DecryptWithPasswordAndLabel, DecryptFixture,
* utf::description("Decrypting a file with password and given label"))
{
libcdoc::RcptInfo rcpt {.type=libcdoc::RcptInfo::LOCK, .label=Label, .secret=std::vector<uint8_t>(Password.cbegin(), Password.cend())};
decrypt({checkDataFile(sources[0])}, checkTargetFile("PasswordUsageWithoutLabel.cdoc"), tmpDataPath, rcpt);
decrypt({checkDataFile(sources[0])}, checkTargetFile("PasswordUsageWithoutLabel.cdoc"), decodeName(tmpDataPath), rcpt);
}
BOOST_AUTO_TEST_SUITE_END()

Expand Down
Loading