Skip to content

Commit 19d61d9

Browse files
authored
Fix Zetes TEST OID and Label expiry date (#79)
MOPPAND-1717 Signed-off-by: Raul Metsma <[email protected]>
1 parent 5eacc3f commit 19d61d9

File tree

3 files changed

+13
-15
lines changed

3 files changed

+13
-15
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -155,26 +155,19 @@ jobs:
155155
with:
156156
path: ${{ github.workspace }}/vcpkg_cache
157157
key: vcpkg-${{ matrix.image }}-${{ matrix.platform }}-${{ hashFiles('vcpkg.json') }}
158-
- name: Prepare vcpkg
159-
uses: lukka/run-vcpkg@v11
160-
with:
161-
vcpkgJsonGlob: ./vcpkg.json
162-
runVcpkgInstall: true
163-
runVcpkgFormatString: "[`install`, `--recurse`, `--clean-after-build`, `--x-install-root`, `$[env.VCPKG_INSTALLED_DIR]`, `--triplet`, `$[env.VCPKG_DEFAULT_TRIPLET]`, `--x-feature`, `tests`]"
164-
env:
165-
VCPKG_BINARY_SOURCES: clear;files,${{ github.workspace }}/vcpkg_cache,readwrite
166-
VCPKG_INSTALLED_DIR: ${{ github.workspace }}/build/vcpkg_installed
167158
- name: Install dependencies
168159
run: winget install --silent --accept-source-agreements --accept-package-agreements swig doxygen
169160
- uses: actions/setup-java@v4
170161
with:
171162
distribution: 'temurin'
172163
java-version: '17'
173164
- name: Build
165+
env:
166+
VCPKG_BINARY_SOURCES: clear;files,${{ github.workspace }}/vcpkg_cache,readwrite
174167
run: |
175168
$swig = (Get-Item "$env:LOCALAPPDATA\Microsoft\WinGet\Links\swig.exe").Target
176169
cmake -A ${{ matrix.platform }} -S . -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo `
177-
"-DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake" `
170+
"-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake" `
178171
"-DSWIG_EXECUTABLE=$swig" `
179172
-DVCPKG_TARGET_TRIPLET=${{ env.VCPKG_DEFAULT_TRIPLET }} `
180173
${{ matrix.platform == 'x64' && '-DVCPKG_MANIFEST_FEATURES=tests' || '' }} `

cdoc/CDoc2Writer.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ createRSACapsule(flatbuffers::FlatBufferBuilder& builder, const libcdoc::Recipie
105105
return cdoc20::header::CreateRecipientRecord(builder,
106106
cdoc20::header::Capsule::recipients_RSAPublicKeyCapsule,
107107
capsule.Union(),
108-
builder.CreateString(rcpt.getLabel({{"x-expiry-time", rcpt.expiry_ts == 0 ? std::string() : std::to_string(rcpt.expiry_ts)}})),
108+
builder.CreateString(rcpt.getLabel({{"server_exp", rcpt.expiry_ts == 0 ? std::string() : std::to_string(rcpt.expiry_ts)}})),
109109
builder.CreateVector(xor_key),
110110
cdoc20::header::FMKEncryptionMethod::XOR);
111111
}
@@ -123,7 +123,7 @@ createRSAServerCapsule(flatbuffers::FlatBufferBuilder& builder, const libcdoc::R
123123
return cdoc20::header::CreateRecipientRecord(builder,
124124
cdoc20::header::Capsule::recipients_KeyServerCapsule,
125125
capsule.Union(),
126-
builder.CreateString(rcpt.getLabel({{"x-expiry-time", std::to_string(expiry_time)}})),
126+
builder.CreateString(rcpt.getLabel({{"server_exp", std::to_string(expiry_time)}})),
127127
builder.CreateVector(xor_key),
128128
cdoc20::header::FMKEncryptionMethod::XOR);
129129
}
@@ -138,7 +138,7 @@ createECCCapsule(flatbuffers::FlatBufferBuilder& builder, const libcdoc::Recipie
138138
return cdoc20::header::CreateRecipientRecord(builder,
139139
cdoc20::header::Capsule::recipients_ECCPublicKeyCapsule,
140140
capsule.Union(),
141-
builder.CreateString(rcpt.getLabel({{"x-expiry-time", rcpt.expiry_ts == 0 ? std::string() : std::to_string(rcpt.expiry_ts)}})),
141+
builder.CreateString(rcpt.getLabel({{"server_exp", rcpt.expiry_ts == 0 ? std::string() : std::to_string(rcpt.expiry_ts)}})),
142142
builder.CreateVector(xor_key),
143143
cdoc20::header::FMKEncryptionMethod::XOR);
144144
}
@@ -157,7 +157,7 @@ createECCServerCapsule(flatbuffers::FlatBufferBuilder& builder, const libcdoc::R
157157
return cdoc20::header::CreateRecipientRecord(builder,
158158
cdoc20::header::Capsule::recipients_KeyServerCapsule,
159159
capsule.Union(),
160-
builder.CreateString(rcpt.getLabel({{"x-expiry-time", std::to_string(expiry_time)}})),
160+
builder.CreateString(rcpt.getLabel({{"server_exp", std::to_string(expiry_time)}})),
161161
builder.CreateVector(xor_key),
162162
cdoc20::header::FMKEncryptionMethod::XOR);
163163
}

cdoc/Recipient.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,13 @@ Recipient::isTheSameRecipient(const std::vector<uint8_t>& public_key) const
142142
static Recipient::EIDType
143143
getEIDType(const std::vector<std::string>& policies)
144144
{
145-
for (const auto& policy : policies)
145+
for (const auto& pol : policies)
146146
{
147+
std::string_view policy = pol;
148+
if (policy.starts_with("2.999.")) { // Zetes TEST OID prefix
149+
policy = policy.substr(6);
150+
}
151+
147152
if (policy.starts_with("1.3.6.1.4.1.51361.1.1.3") ||
148153
policy.starts_with("1.3.6.1.4.1.51361.1.2.3")) {
149154
return Recipient::EIDType::DigiID;

0 commit comments

Comments
 (0)