Skip to content

Commit

Permalink
Siva3 compatibility (#318)
Browse files Browse the repository at this point in the history
Signed-off-by: Hans Niinemäe <[email protected]>
  • Loading branch information
hniinemae authored and kristelmerilain committed Oct 11, 2019
1 parent a1aa2f6 commit cfb82e5
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions src/SiVaContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,10 @@ SiVaContainer::SiVaContainer(const string &path, const string &ext)
}

string url = CONF(verifyServiceUri);
const bool isV2 = url.find("V2") != string::npos;
jsonxx::Object reqObj = jsonxx::Object() <<"filename" << File::fileName(path) << "document" << b64;
if(isV2)
reqObj << "signaturePolicy" << "POLv4";
else
reqObj << "documentType" << ext;
jsonxx::Object reqObj = jsonxx::Object()
<<"filename" << File::fileName(path)
<< "document" << b64
<< "signaturePolicy" << "POLv4";
string req = reqObj.json();
Connect::Result r = Connect(url, "POST", 0, string(), CONF(verifyServiceCert)).exec({
{"Content-Type", "application/json;charset=UTF-8"}
Expand All @@ -160,14 +158,8 @@ SiVaContainer::SiVaContainer(const string &path, const string &ext)
throw e;
}

jsonxx::Object base;
if(isV2)
{
jsonxx::Object report = result.get<jsonxx::Object>("validationReport");
base = report.get<jsonxx::Object>("validationConclusion");
}
else
base = result;
jsonxx::Object report = result.get<jsonxx::Object>("validationReport");
jsonxx::Object base = report.get<jsonxx::Object>("validationConclusion");
for(const jsonxx::Value *obj: base.get<jsonxx::Array>("signatures", jsonxx::Array()).values())
{
SignatureSiVa *s = new SignatureSiVa;
Expand Down

0 comments on commit cfb82e5

Please sign in to comment.