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
13 changes: 3 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,26 +155,19 @@ jobs:
with:
path: ${{ github.workspace }}/vcpkg_cache
key: vcpkg-${{ matrix.image }}-${{ matrix.platform }}-${{ hashFiles('vcpkg.json') }}
- name: Prepare vcpkg
uses: lukka/run-vcpkg@v11
with:
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_BINARY_SOURCES: clear;files,${{ github.workspace }}/vcpkg_cache,readwrite
VCPKG_INSTALLED_DIR: ${{ github.workspace }}/build/vcpkg_installed
- name: Install dependencies
run: winget install --silent --accept-source-agreements --accept-package-agreements swig doxygen
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Build
env:
VCPKG_BINARY_SOURCES: clear;files,${{ github.workspace }}/vcpkg_cache,readwrite
run: |
$swig = (Get-Item "$env:LOCALAPPDATA\Microsoft\WinGet\Links\swig.exe").Target
cmake -A ${{ matrix.platform }} -S . -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo `
"-DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake" `
"-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake" `
"-DSWIG_EXECUTABLE=$swig" `
-DVCPKG_TARGET_TRIPLET=${{ env.VCPKG_DEFAULT_TRIPLET }} `
${{ matrix.platform == 'x64' && '-DVCPKG_MANIFEST_FEATURES=tests' || '' }} `
Expand Down
8 changes: 4 additions & 4 deletions cdoc/CDoc2Writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ createRSACapsule(flatbuffers::FlatBufferBuilder& builder, const libcdoc::Recipie
return cdoc20::header::CreateRecipientRecord(builder,
cdoc20::header::Capsule::recipients_RSAPublicKeyCapsule,
capsule.Union(),
builder.CreateString(rcpt.getLabel({{"x-expiry-time", rcpt.expiry_ts == 0 ? std::string() : std::to_string(rcpt.expiry_ts)}})),
builder.CreateString(rcpt.getLabel({{"server_exp", rcpt.expiry_ts == 0 ? std::string() : std::to_string(rcpt.expiry_ts)}})),
builder.CreateVector(xor_key),
cdoc20::header::FMKEncryptionMethod::XOR);
}
Expand All @@ -123,7 +123,7 @@ createRSAServerCapsule(flatbuffers::FlatBufferBuilder& builder, const libcdoc::R
return cdoc20::header::CreateRecipientRecord(builder,
cdoc20::header::Capsule::recipients_KeyServerCapsule,
capsule.Union(),
builder.CreateString(rcpt.getLabel({{"x-expiry-time", std::to_string(expiry_time)}})),
builder.CreateString(rcpt.getLabel({{"server_exp", std::to_string(expiry_time)}})),
builder.CreateVector(xor_key),
cdoc20::header::FMKEncryptionMethod::XOR);
}
Expand All @@ -138,7 +138,7 @@ createECCCapsule(flatbuffers::FlatBufferBuilder& builder, const libcdoc::Recipie
return cdoc20::header::CreateRecipientRecord(builder,
cdoc20::header::Capsule::recipients_ECCPublicKeyCapsule,
capsule.Union(),
builder.CreateString(rcpt.getLabel({{"x-expiry-time", rcpt.expiry_ts == 0 ? std::string() : std::to_string(rcpt.expiry_ts)}})),
builder.CreateString(rcpt.getLabel({{"server_exp", rcpt.expiry_ts == 0 ? std::string() : std::to_string(rcpt.expiry_ts)}})),
builder.CreateVector(xor_key),
cdoc20::header::FMKEncryptionMethod::XOR);
}
Expand All @@ -157,7 +157,7 @@ createECCServerCapsule(flatbuffers::FlatBufferBuilder& builder, const libcdoc::R
return cdoc20::header::CreateRecipientRecord(builder,
cdoc20::header::Capsule::recipients_KeyServerCapsule,
capsule.Union(),
builder.CreateString(rcpt.getLabel({{"x-expiry-time", std::to_string(expiry_time)}})),
builder.CreateString(rcpt.getLabel({{"server_exp", std::to_string(expiry_time)}})),
builder.CreateVector(xor_key),
cdoc20::header::FMKEncryptionMethod::XOR);
}
Expand Down
7 changes: 6 additions & 1 deletion cdoc/Recipient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,13 @@ Recipient::isTheSameRecipient(const std::vector<uint8_t>& public_key) const
static Recipient::EIDType
getEIDType(const std::vector<std::string>& policies)
{
for (const auto& policy : policies)
for (const auto& pol : policies)
{
std::string_view policy = pol;
if (policy.starts_with("2.999.")) { // Zetes TEST OID prefix
policy = policy.substr(6);
}

if (policy.starts_with("1.3.6.1.4.1.51361.1.1.3") ||
policy.starts_with("1.3.6.1.4.1.51361.1.2.3")) {
return Recipient::EIDType::DigiID;
Expand Down
Loading