Skip to content
Open
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
8 changes: 4 additions & 4 deletions src/SignatureXAdES_B.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ void SignatureXAdES_B::validate(const string &policy) const

map<string,string> signatureref;
string_view signedPropertiesId = sp["Id"];
bool signedInfoFound = false;
int signedInfoFound = 0;
for(auto ref = signature/"SignedInfo"/"Reference"; ref; ref++)
{
auto uri = ref["URI"];
Expand All @@ -498,7 +498,7 @@ void SignatureXAdES_B::validate(const string &policy) const
}

if(uri.front() == '#' && uri.substr(1) == signedPropertiesId && ref["Type"] == REF_TYPE)
signedInfoFound = true;
++signedInfoFound;
else if(!sdop)
continue; // DataObjectProperties is missing, no need to match later MediaTypes
else if(ref["Id"].empty())
Expand All @@ -511,8 +511,8 @@ void SignatureXAdES_B::validate(const string &policy) const
signatureref.emplace(uriPath, mimeinfo[string("#").append(ref["Id"])]);
}
}
if(!signedInfoFound)
EXCEPTION_ADD(exception, "SignedProperties not found");
if(signedInfoFound != 1)
EXCEPTION_ADD(exception, "Exactly one SignedProperties Reference required, found %d", signedInfoFound);

// Match DataObjectFormat element MediaTypes with Manifest
if(!signatureref.empty())
Expand Down
Loading