Skip to content

Commit 84a4a92

Browse files
author
Lauris Kaplinski
committed
Use property system for automatic label generation
1 parent af001aa commit 84a4a92

File tree

8 files changed

+150
-116
lines changed

8 files changed

+150
-116
lines changed

cdoc/CDoc.h

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,43 @@ struct FileInfo {
183183
int64_t size;
184184
};
185185

186+
/**
187+
* @brief CDoc2-specific public values
188+
*
189+
* This is class (instead of namespace) to streamline Swig wrapping
190+
*/
191+
struct CDOC_EXPORT CDoc2 final {
192+
193+
/**
194+
* @brief Recipient types for machine-readable labels
195+
*
196+
*/
197+
static constexpr std::string_view TYPE_PASSWORD = "pw";
198+
static constexpr std::string_view TYPE_SYMMETRIC = "secret";
199+
static constexpr std::string_view TYPE_PUBLIC_KEY = "pub_key";
200+
static constexpr std::string_view TYPE_CERTIFICATE = "cert";
201+
static constexpr std::string_view TYPE_UNKNOWN = "Unknown";
202+
static constexpr std::string_view TYPE_ID_CARD = "ID-card";
203+
static constexpr std::string_view TYPE_DIGI_ID = "Digi-ID";
204+
static constexpr std::string_view TYPE_DIGI_ID_E_RESIDENT = "Digi-ID E-RESIDENT";
205+
206+
/**
207+
* @brief Recipient data for machine-readable labels
208+
*
209+
*/
210+
static constexpr std::string_view LBL_VERSION = "v";
211+
static constexpr std::string_view LBL_TYPE = "type";
212+
static constexpr std::string_view LBL_FILE = "file";
213+
static constexpr std::string_view LBL_LABEL = "label";
214+
static constexpr std::string_view LBL_CN = "cn";
215+
static constexpr std::string_view LBL_SERIAL_NUMBER = "serial_number";
216+
static constexpr std::string_view LBL_LAST_NAME = "last_name";
217+
static constexpr std::string_view LBL_FIRST_NAME = "first_name";
218+
static constexpr std::string_view LBL_CERT_SHA1 = "cert_sha1";
219+
220+
CDoc2() = delete;
221+
};
222+
186223
}; // namespace libcdoc
187224

188225
#endif // CDOC_H

cdoc/CDoc2.h

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@
1919
#ifndef __CDOC2_H__
2020
#define __CDOC2_H__
2121

22+
#include "CDoc.h"
23+
2224
#include <string_view>
2325

2426
namespace libcdoc {
25-
namespace CDoc2 {
27+
namespace CDoc2Internal {
2628

2729
static constexpr std::string_view LABEL = "CDOC\x02";
2830
static constexpr std::string_view CEK = "CDOC20cek";
@@ -53,15 +55,15 @@ constexpr std::string_view LABELPREFIX{"data:"};
5355
*/
5456
constexpr std::string_view LABELBASE64IND{";base64,"};
5557

56-
/**
57-
* @brief EID type values for machine-readable label
58-
*/
59-
static constexpr std::string_view eid_strs[] = {
60-
"Unknown",
61-
"ID-card",
62-
"Digi-ID",
63-
"Digi-ID E-RESIDENT"
64-
};
58+
/**
59+
* @brief EID type values for machine-readable label
60+
*/
61+
static constexpr std::string_view eid_strs[] = {
62+
CDoc2::TYPE_UNKNOWN,
63+
CDoc2::TYPE_ID_CARD,
64+
CDoc2::TYPE_DIGI_ID,
65+
CDoc2::TYPE_DIGI_ID_E_RESIDENT
66+
};
6567

6668
} // namespace CDoc2
6769
} // namespace libcdoc

cdoc/CDoc2Reader.cpp

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,19 @@ using namespace libcdoc;
4747
// Get salt bitstring for HKDF expand method
4848

4949
std::string
50-
libcdoc::CDoc2::getSaltForExpand(const std::string& label)
50+
libcdoc::CDoc2Internal::getSaltForExpand(const std::string& label)
5151
{
5252
std::ostringstream oss;
53-
oss << libcdoc::CDoc2::KEK << cdoc20::header::EnumNameFMKEncryptionMethod(cdoc20::header::FMKEncryptionMethod::XOR) << label;
53+
oss << libcdoc::CDoc2Internal::KEK << cdoc20::header::EnumNameFMKEncryptionMethod(cdoc20::header::FMKEncryptionMethod::XOR) << label;
5454
return oss.str();
5555
}
5656

5757
// Get salt bitstring for HKDF expand method
5858
std::string
59-
libcdoc::CDoc2::getSaltForExpand(const std::vector<uint8_t>& key_material, const std::vector<uint8_t>& rcpt_key)
59+
libcdoc::CDoc2Internal::getSaltForExpand(const std::vector<uint8_t>& key_material, const std::vector<uint8_t>& rcpt_key)
6060
{
6161
std::ostringstream oss;
62-
oss << libcdoc::CDoc2::KEK
62+
oss << libcdoc::CDoc2Internal::KEK
6363
<< cdoc20::header::EnumNameFMKEncryptionMethod(cdoc20::header::FMKEncryptionMethod::XOR)
6464
<< std::string_view((const char*)rcpt_key.data(), rcpt_key.size())
6565
<< std::string_view((const char*)key_material.data(), key_material.size());
@@ -149,7 +149,7 @@ CDoc2Reader::getFMK(std::vector<uint8_t>& fmk, unsigned int lock_idx)
149149
if (lock.type == Lock::Type::PASSWORD) {
150150
// Password
151151
LOG_DBG("password");
152-
std::string info_str = libcdoc::CDoc2::getSaltForExpand(lock.label);
152+
std::string info_str = libcdoc::CDoc2Internal::getSaltForExpand(lock.label);
153153
LOG_DBG("info: {}", toHex(info_str));
154154
std::vector<uint8_t> kek_pm;
155155
if (auto rv = crypto->extractHKDF(kek_pm, lock.getBytes(Lock::SALT), lock.getBytes(Lock::PW_SALT), lock.getInt(Lock::KDF_ITER), lock_idx); rv != libcdoc::OK) {
@@ -163,7 +163,7 @@ CDoc2Reader::getFMK(std::vector<uint8_t>& fmk, unsigned int lock_idx)
163163
} else if (lock.type == Lock::Type::SYMMETRIC_KEY) {
164164
// Symmetric key
165165
LOG_DBG("symmetric");
166-
std::string info_str = libcdoc::CDoc2::getSaltForExpand(lock.label);
166+
std::string info_str = libcdoc::CDoc2Internal::getSaltForExpand(lock.label);
167167
LOG_DBG("info: {}", toHex(info_str));
168168
std::vector<uint8_t> kek_pm;
169169
if (auto rv = crypto->extractHKDF(kek_pm, lock.getBytes(Lock::SALT), {}, 0, lock_idx); rv != libcdoc::OK) {
@@ -217,16 +217,16 @@ CDoc2Reader::getFMK(std::vector<uint8_t>& fmk, unsigned int lock_idx)
217217
}
218218
} else {
219219
std::vector<uint8_t> kek_pm;
220-
int result = crypto->deriveHMACExtract(kek_pm, key_material, toUint8Vector(libcdoc::CDoc2::KEKPREMASTER), lock_idx);
220+
int result = crypto->deriveHMACExtract(kek_pm, key_material, toUint8Vector(libcdoc::CDoc2Internal::KEKPREMASTER), lock_idx);
221221
if (result < 0) {
222222
setLastError(crypto->getLastErrorStr(result));
223223
LOG_ERROR("{}", last_error);
224224
return result;
225225
}
226226
LOG_TRACE_KEY("Key kekPm: {}", kek_pm);
227-
std::string info_str = libcdoc::CDoc2::getSaltForExpand(key_material, lock.getBytes(Lock::Params::RCPT_KEY));
227+
std::string info_str = libcdoc::CDoc2Internal::getSaltForExpand(key_material, lock.getBytes(Lock::Params::RCPT_KEY));
228228
LOG_DBG("info: {}", toHex(info_str));
229-
kek = libcdoc::Crypto::expand(kek_pm, info_str, libcdoc::CDoc2::KEY_LEN);
229+
kek = libcdoc::Crypto::expand(kek_pm, info_str, libcdoc::CDoc2Internal::KEY_LEN);
230230
}
231231
} else if (lock.type == Lock::Type::SHARE_SERVER) {
232232
/* SALT */
@@ -345,7 +345,7 @@ CDoc2Reader::getFMK(std::vector<uint8_t>& fmk, unsigned int lock_idx)
345345
LOG_ERROR("{}", last_error);
346346
return libcdoc::CRYPTO_ERROR;
347347
}
348-
std::vector<uint8_t> hhk = libcdoc::Crypto::expand(fmk, libcdoc::CDoc2::HMAC);
348+
std::vector<uint8_t> hhk = libcdoc::Crypto::expand(fmk, libcdoc::CDoc2Internal::HMAC);
349349

350350
LOG_TRACE_KEY("xor: {}", lock.encrypted_fmk);
351351
LOG_TRACE_KEY("fmk: {}", fmk);
@@ -409,11 +409,11 @@ CDoc2Reader::beginDecryption(const std::vector<uint8_t>& fmk)
409409
}
410410
}
411411
priv->_at_nonce = false;
412-
std::vector<uint8_t> cek = libcdoc::Crypto::expand(fmk, libcdoc::CDoc2::CEK);
412+
std::vector<uint8_t> cek = libcdoc::Crypto::expand(fmk, libcdoc::CDoc2Internal::CEK);
413413
LOG_TRACE_KEY("cek: {}", cek);
414414

415-
priv->dec = std::make_unique<libcdoc::DecryptionSource>(*priv->_src, EVP_chacha20_poly1305(), cek, libcdoc::CDoc2::NONCE_LEN);
416-
std::vector<uint8_t> aad = toUint8Vector(libcdoc::CDoc2::PAYLOAD);
415+
priv->dec = std::make_unique<libcdoc::DecryptionSource>(*priv->_src, EVP_chacha20_poly1305(), cek, libcdoc::CDoc2Internal::NONCE_LEN);
416+
std::vector<uint8_t> aad = toUint8Vector(libcdoc::CDoc2Internal::PAYLOAD);
417417
aad.insert(aad.end(), priv->header_data.cbegin(), priv->header_data.cend());
418418
aad.insert(aad.end(), priv->headerHMAC.cbegin(), priv->headerHMAC.cend());
419419
if(auto rv = priv->dec->updateAAD(aad); rv != OK) {
@@ -621,16 +621,16 @@ CDoc2Reader::CDoc2Reader(libcdoc::DataSource *src, bool take_ownership)
621621

622622
setLastError(t_("Invalid CDoc 2.0 header"));
623623

624-
uint8_t in[libcdoc::CDoc2::LABEL.size()];
625-
if (priv->_src->read(in, libcdoc::CDoc2::LABEL.size()) != libcdoc::CDoc2::LABEL.size()) {
624+
uint8_t in[libcdoc::CDoc2Internal::LABEL.size()];
625+
if (priv->_src->read(in, libcdoc::CDoc2Internal::LABEL.size()) != libcdoc::CDoc2Internal::LABEL.size()) {
626626
LOG_ERROR("{}", last_error);
627627
return;
628628
}
629-
if (memcmp(libcdoc::CDoc2::LABEL.data(), in, libcdoc::CDoc2::LABEL.size())) {
629+
if (memcmp(libcdoc::CDoc2Internal::LABEL.data(), in, libcdoc::CDoc2Internal::LABEL.size())) {
630630
LOG_ERROR("{}", last_error);
631631
return;
632632
}
633-
//if (libcdoc::CDoc2::LABEL.compare(0, libcdoc::CDoc2::LABEL.size(), (const char *) in)) return;
633+
//if (libcdoc::CDoc2Internal::LABEL.compare(0, libcdoc::CDoc2Internal::LABEL.size(), (const char *) in)) return;
634634

635635
// Read 32-bit header length in big endian order
636636
uint8_t c[4];
@@ -648,13 +648,13 @@ CDoc2Reader::CDoc2Reader(libcdoc::DataSource *src, bool take_ownership)
648648
LOG_ERROR("{}", last_error);
649649
return;
650650
}
651-
priv->headerHMAC.resize(libcdoc::CDoc2::KEY_LEN);
652-
if (priv->_src->read(priv->headerHMAC.data(), libcdoc::CDoc2::KEY_LEN) != libcdoc::CDoc2::KEY_LEN) {
651+
priv->headerHMAC.resize(libcdoc::CDoc2Internal::KEY_LEN);
652+
if (priv->_src->read(priv->headerHMAC.data(), libcdoc::CDoc2Internal::KEY_LEN) != libcdoc::CDoc2Internal::KEY_LEN) {
653653
LOG_ERROR("{}", last_error);
654654
return;
655655
}
656656

657-
priv->_nonce_pos = libcdoc::CDoc2::LABEL.size() + 4 + header_len + libcdoc::CDoc2::KEY_LEN;
657+
priv->_nonce_pos = libcdoc::CDoc2Internal::LABEL.size() + 4 + header_len + libcdoc::CDoc2Internal::KEY_LEN;
658658
priv->_at_nonce = true;
659659

660660
flatbuffers::Verifier verifier(priv->header_data.data(), priv->header_data.size());
@@ -687,12 +687,12 @@ CDoc2Reader::CDoc2Reader(libcdoc::DataSource *src, bool take_ownership)
687687
bool
688688
CDoc2Reader::isCDoc2File(libcdoc::DataSource *src)
689689
{
690-
std::array<uint8_t,libcdoc::CDoc2::LABEL.size()> in {};
690+
std::array<uint8_t,libcdoc::CDoc2Internal::LABEL.size()> in {};
691691
if (src->read(in.data(), in.size()) != in.size()) {
692692
LOG_DBG("CDoc2Reader::isCDoc2File: Cannot read tag");
693693
return false;
694694
}
695-
if (libcdoc::CDoc2::LABEL.compare(0, in.size(), (char *) in.data(), in.size())) {
695+
if (libcdoc::CDoc2Internal::LABEL.compare(0, in.size(), (char *) in.data(), in.size())) {
696696
LOG_DBG("CDoc2Reader::isCDoc2File: Invalid tag: {}", toHex(in));
697697
return false;
698698
}

cdoc/CDoc2Writer.cpp

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ CDoc2Writer::writeHeader(const std::vector<libcdoc::Recipient> &recipients)
4949
return libcdoc::WRONG_ARGUMENTS;
5050
}
5151
std::vector<uint8_t> rnd;
52-
if(auto rv = crypto->random(rnd, libcdoc::CDoc2::KEY_LEN); rv < 0)
52+
if(auto rv = crypto->random(rnd, libcdoc::CDoc2Internal::KEY_LEN); rv < 0)
5353
return rv;
54-
std::vector<uint8_t> fmk = libcdoc::Crypto::extract(rnd, {libcdoc::CDoc2::SALT.cbegin(), libcdoc::CDoc2::SALT.cend()});
54+
std::vector<uint8_t> fmk = libcdoc::Crypto::extract(rnd, {libcdoc::CDoc2Internal::SALT.cbegin(), libcdoc::CDoc2Internal::SALT.cend()});
5555
std::fill(rnd.begin(), rnd.end(), 0);
5656
LOG_TRACE_KEY("fmk: {}", fmk);
5757

@@ -62,8 +62,8 @@ CDoc2Writer::writeHeader(const std::vector<libcdoc::Recipient> &recipients)
6262
return rv;
6363
}
6464

65-
auto hhk = libcdoc::Crypto::expand(fmk, libcdoc::CDoc2::HMAC);
66-
auto cek = libcdoc::Crypto::expand(fmk, libcdoc::CDoc2::CEK);
65+
auto hhk = libcdoc::Crypto::expand(fmk, libcdoc::CDoc2Internal::HMAC);
66+
auto cek = libcdoc::Crypto::expand(fmk, libcdoc::CDoc2Internal::CEK);
6767
std::fill(fmk.begin(), fmk.end(), 0);
6868
LOG_TRACE_KEY("cek: {}", cek);
6969
LOG_TRACE_KEY("hhk: {}", hhk);
@@ -75,16 +75,16 @@ CDoc2Writer::writeHeader(const std::vector<libcdoc::Recipient> &recipients)
7575
// FIXME: not big/little endian friendly
7676
uint8_t header_len[] {uint8_t(hs >> 24), uint8_t((hs >> 16) & 0xff), uint8_t((hs >> 8) & 0xff), uint8_t(hs & 0xff)};
7777

78-
dst->write((const uint8_t *) libcdoc::CDoc2::LABEL.data(), libcdoc::CDoc2::LABEL.size());
78+
dst->write((const uint8_t *) libcdoc::CDoc2Internal::LABEL.data(), libcdoc::CDoc2Internal::LABEL.size());
7979
dst->write((const uint8_t *) &header_len, 4);
8080
dst->write(header.data(), header.size());
8181
dst->write(headerHMAC.data(), headerHMAC.size());
8282

8383
std::vector<uint8_t> nonce;
84-
crypto->random(nonce, libcdoc::CDoc2::NONCE_LEN);
84+
crypto->random(nonce, libcdoc::CDoc2Internal::NONCE_LEN);
8585
LOG_TRACE_KEY("nonce: {}", nonce);
8686
auto cipher = std::make_unique<EncryptionConsumer>(*dst, EVP_chacha20_poly1305(), Crypto::Key(std::move(cek), nonce));
87-
std::vector<uint8_t> aad(libcdoc::CDoc2::PAYLOAD.cbegin(), libcdoc::CDoc2::PAYLOAD.cend());
87+
std::vector<uint8_t> aad(libcdoc::CDoc2Internal::PAYLOAD.cbegin(), libcdoc::CDoc2Internal::PAYLOAD.cend());
8888
aad.insert(aad.end(), header.cbegin(), header.cend());
8989
aad.insert(aad.end(), headerHMAC.cbegin(), headerHMAC.cend());
9090
if(auto rv = cipher->writeAAD(aad); rv < 0)
@@ -198,7 +198,7 @@ CDoc2Writer::buildHeader(std::vector<uint8_t>& header, const std::vector<libcdoc
198198
flatbuffers::FlatBufferBuilder builder;
199199
std::vector<flatbuffers::Offset<cdoc20::header::RecipientRecord>> fb_rcpts;
200200

201-
std::vector<uint8_t> xor_key(libcdoc::CDoc2::KEY_LEN);
201+
std::vector<uint8_t> xor_key(libcdoc::CDoc2Internal::KEY_LEN);
202202
for (unsigned int rcpt_idx = 0; rcpt_idx < recipients.size(); rcpt_idx++) {
203203
const libcdoc::Recipient& rcpt = recipients.at(rcpt_idx);
204204
if (rcpt.isPKI()) {
@@ -223,7 +223,7 @@ CDoc2Writer::buildHeader(std::vector<uint8_t>& header, const std::vector<libcdoc
223223
}
224224
}
225225
if(rcpt.pk_type == libcdoc::Recipient::PKType::RSA) {
226-
crypto->random(kek, libcdoc::CDoc2::KEY_LEN);
226+
crypto->random(kek, libcdoc::CDoc2Internal::KEY_LEN);
227227
if (libcdoc::Crypto::xor_data(xor_key, fmk, kek) != libcdoc::OK) {
228228
setLastError("Internal error");
229229
LOG_ERROR("{}", last_error);
@@ -267,8 +267,8 @@ CDoc2Writer::buildHeader(std::vector<uint8_t>& header, const std::vector<libcdoc
267267
auto ephKey = libcdoc::Crypto::genECKey(publicKey.get());
268268
std::vector<uint8_t> sharedSecret = libcdoc::Crypto::deriveSharedSecret(ephKey.get(), publicKey.get());
269269
key_material = libcdoc::Crypto::toPublicKeyDer(ephKey.get());
270-
std::vector<uint8_t> kekPm = libcdoc::Crypto::extract(sharedSecret, std::vector<uint8_t>(libcdoc::CDoc2::KEKPREMASTER.cbegin(), libcdoc::CDoc2::KEKPREMASTER.cend()));
271-
std::string info_str = libcdoc::CDoc2::getSaltForExpand(key_material, rcpt.rcpt_key);
270+
std::vector<uint8_t> kekPm = libcdoc::Crypto::extract(sharedSecret, std::vector<uint8_t>(libcdoc::CDoc2Internal::KEKPREMASTER.cbegin(), libcdoc::CDoc2Internal::KEKPREMASTER.cend()));
271+
std::string info_str = libcdoc::CDoc2Internal::getSaltForExpand(key_material, rcpt.rcpt_key);
272272

273273
kek = libcdoc::Crypto::expand(kekPm, info_str, fmk.size());
274274
if (libcdoc::Crypto::xor_data(xor_key, fmk, kek) != libcdoc::OK) {
@@ -302,16 +302,16 @@ CDoc2Writer::buildHeader(std::vector<uint8_t>& header, const std::vector<libcdoc
302302
}
303303
}
304304
} else if (rcpt.isSymmetric()) {
305-
std::string info_str = libcdoc::CDoc2::getSaltForExpand(rcpt.getLabel({}));
306-
std::vector<uint8_t> kek_pm(libcdoc::CDoc2::KEY_LEN);
305+
std::string info_str = libcdoc::CDoc2Internal::getSaltForExpand(rcpt.getLabel({}));
306+
std::vector<uint8_t> kek_pm(libcdoc::CDoc2Internal::KEY_LEN);
307307
std::vector<uint8_t> salt;
308-
int64_t result = crypto->random(salt, libcdoc::CDoc2::KEY_LEN);
308+
int64_t result = crypto->random(salt, libcdoc::CDoc2Internal::KEY_LEN);
309309
if (result < 0) {
310310
setLastError(crypto->getLastErrorStr(result));
311311
return result;
312312
}
313313
std::vector<uint8_t> pw_salt;
314-
result = crypto->random(pw_salt, libcdoc::CDoc2::KEY_LEN);
314+
result = crypto->random(pw_salt, libcdoc::CDoc2Internal::KEY_LEN);
315315
if (result < 0) {
316316
setLastError(crypto->getLastErrorStr(result));
317317
return result;
@@ -321,7 +321,7 @@ CDoc2Writer::buildHeader(std::vector<uint8_t>& header, const std::vector<libcdoc
321321
setLastError(crypto->getLastErrorStr(result));
322322
return result;
323323
}
324-
std::vector<uint8_t> kek = libcdoc::Crypto::expand(kek_pm, info_str, libcdoc::CDoc2::KEY_LEN);
324+
std::vector<uint8_t> kek = libcdoc::Crypto::expand(kek_pm, info_str, libcdoc::CDoc2Internal::KEY_LEN);
325325

326326
LOG_DBG("Label: {}", rcpt.label);
327327
LOG_DBG("KDF iter: {}", rcpt.kdf_iter);
@@ -368,11 +368,11 @@ CDoc2Writer::buildHeader(std::vector<uint8_t>& header, const std::vector<libcdoc
368368
//# KEK_i computation:
369369
//KeyMaterialSalt_i = CSRNG(256)
370370
std::vector<uint8_t> key_material_salt;
371-
crypto->random(key_material_salt, libcdoc::CDoc2::KEY_LEN);
371+
crypto->random(key_material_salt, libcdoc::CDoc2Internal::KEY_LEN);
372372

373373
//KeyMaterial_i = CSRNG(256)
374374
std::vector<uint8_t> key_material;
375-
crypto->random(key_material, libcdoc::CDoc2::KEY_LEN);
375+
crypto->random(key_material, libcdoc::CDoc2Internal::KEY_LEN);
376376

377377
//KEK_i_pm = HKDF_Extract(KeyMaterialSalt_i, KeyMaterial_i)
378378
std::vector<uint8_t> kek_pm = libcdoc::Crypto::extract(key_material_salt, key_material);
@@ -394,7 +394,7 @@ CDoc2Writer::buildHeader(std::vector<uint8_t>& header, const std::vector<libcdoc
394394
std::vector<std::vector<uint8_t>> kek_shares(N_SHARES);
395395
for (int i = 1; i < N_SHARES; i++) {
396396
// KEK_i_share_j = CSRNG(256)
397-
crypto->random(kek_shares[i], libcdoc::CDoc2::KEY_LEN);
397+
crypto->random(kek_shares[i], libcdoc::CDoc2Internal::KEY_LEN);
398398
}
399399
// KEK_i_share_1 = XOR(KEK_i, KEK_i_share_2, KEK_i_share_3,..., KEK_i_share_n)
400400
kek_shares[0] = std::move(kek);

cdoc/Lock.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,20 +58,20 @@ Lock::parseLabel(const std::string& label)
5858
{
5959
std::map<std::string, std::string> parsed_label;
6060
// Check if provided label starts with the machine generated label prefix.
61-
if (!label.starts_with(CDoc2::LABELPREFIX))
61+
if (!label.starts_with(CDoc2Internal::LABELPREFIX))
6262
{
6363
return parsed_label;
6464
}
6565

66-
std::string label_wo_prefix(label.substr(CDoc2::LABELPREFIX.size()));
66+
std::string label_wo_prefix(label.substr(CDoc2Internal::LABELPREFIX.size()));
6767

6868
// Label to be processed
6969
std::string label_to_prcss;
7070

7171
// We ignore mediatype part
7272

7373
// Check, if the label is Base64 encoded
74-
auto base64IndPos = label_wo_prefix.find(CDoc2::LABELBASE64IND);
74+
auto base64IndPos = label_wo_prefix.find(CDoc2Internal::LABELBASE64IND);
7575
if (base64IndPos == std::string::npos)
7676
{
7777
if (label_wo_prefix.starts_with(",")) {
@@ -82,7 +82,7 @@ Lock::parseLabel(const std::string& label)
8282
}
8383
else
8484
{
85-
std::string base64_label(label_wo_prefix.substr(base64IndPos + CDoc2::LABELBASE64IND.size()));
85+
std::string base64_label(label_wo_prefix.substr(base64IndPos + CDoc2Internal::LABELBASE64IND.size()));
8686
std::vector<uint8_t> decodedLabel(fromBase64(base64_label));
8787
label_to_prcss.assign(decodedLabel.cbegin(), decodedLabel.cend());
8888
}

0 commit comments

Comments
 (0)