Skip to content
Open
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
10 changes: 4 additions & 6 deletions src/SignatureXAdES_B.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,11 @@ int initXmlSecCallback()
return {};
}

auto find = [name](auto files) -> const DataFile* {
string uriName = File::fromUriPath(name);
auto find = [&uriName](auto files) -> const DataFile* {
for(const DataFile *file: files)
{
if(file->fileName() == name)
if(file->fileName() == uriName)
return file;
}
return {};
Expand Down Expand Up @@ -505,10 +506,7 @@ void SignatureXAdES_B::validate(const string &policy) const
EXCEPTION_ADD(exception, "Reference '%.*s' ID missing", int(uri.size()), uri.data());
else
{
string uriPath = File::fromUriPath(uri);
if(uriPath.front() == '/')
uriPath.erase(0);
signatureref.emplace(uriPath, mimeinfo[string("#").append(ref["Id"])]);
signatureref.emplace(File::fromUriPath(uri), mimeinfo[string("#").append(ref["Id"])]);
}
}
if(!signedInfoFound)
Expand Down
3 changes: 0 additions & 3 deletions src/SignatureXAdES_LTA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ void SignatureXAdES_LTA::calcArchiveDigest(const Digest &digest, string_view can
}

string uriPath = File::fromUriPath(uri);
if(uriPath.front() == '/')
uriPath.erase(0);

auto files = bdoc->dataFiles();
auto file = find_if(files.cbegin(), files.cend(), [&uriPath](DataFile *file) {
return file->fileName() == uriPath;
Expand Down
2 changes: 2 additions & 0 deletions src/util/File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,8 @@ constexpr bool fromHexChar(auto pos, auto end, auto &value)

string File::fromUriPath(string_view path)
{
if(!path.empty() && path.front() == '/')
path.remove_prefix(1);
string ret;
ret.reserve(path.size());
uint8_t value = 0;
Expand Down
Loading
Loading