fixed some build errors
diff --git a/src/ca-module.cpp b/src/ca-module.cpp
index 275e1f8..4398de7 100644
--- a/src/ca-module.cpp
+++ b/src/ca-module.cpp
@@ -149,12 +149,12 @@
// process PROBE requests: find an available name
std::string availableId;
const auto& parameterTLV = request.getApplicationParameters();
+ parameterTLV.parse();
if (!parameterTLV.hasValue()) {
_LOG_ERROR("Empty TLV obtained from the Interest parameter.");
return;
}
//std::string probeInfoStr = parameterJson.get(JSON_CLIENT_PROBE_INFO, "");
- // TODO: m_probeHandler is never set
if (m_config.m_probeHandler) {
try {
availableId = m_config.m_probeHandler(parameterTLV);
@@ -171,6 +171,7 @@
Name newIdentityName = m_config.m_caName;
newIdentityName.append(availableId);
_LOG_TRACE("Handle PROBE: generate an identity " << newIdentityName);
+
Block contentTLV = PROBE::encodeDataContent(newIdentityName.toUri(), m_config.m_probe, parameterTLV);
Data result;
@@ -311,22 +312,20 @@
return;
}
- // TODO: any simpler method?
- bool isSucess;
- Block paramTLV;
- std::tie<bool, Block>(isSucess, paramTLV) = Block::fromBuffer(paramTLVPayload.data(), paramTLVPayload.size());
+ Block paramTLV = makeBinaryBlock(tlv_encrypted_payload, paramTLVPayload.data(), paramTLVPayload.size());
+ paramTLV.parse();
// load the corresponding challenge module
std::string challengeType = readString(paramTLV.get(tlv_selected_challenge));
auto challenge = ChallengeModule::createChallengeModule(challengeType);
- Block contentTLV;
+ Block payload;
if (challenge == nullptr) {
_LOG_TRACE("Unrecognized challenge type " << challengeType);
certRequest.m_status = STATUS_FAILURE;
certRequest.m_challengeStatus = CHALLENGE_STATUS_UNKNOWN_CHALLENGE;
- contentTLV = CHALLENGE::encodeDataPayload(certRequest);
+ payload = CHALLENGE::encodeDataPayload(certRequest);
}
else {
_LOG_TRACE("CHALLENGE module to be load: " << challengeType);
@@ -335,7 +334,7 @@
if (certRequest.m_status == STATUS_FAILURE) {
// if challenge failed
m_storage->deleteRequest(certRequest.m_requestId);
- contentTLV = CHALLENGE::encodeDataPayload(certRequest);
+ payload = CHALLENGE::encodeDataPayload(certRequest);
_LOG_TRACE("Challenge failed");
}
else if (certRequest.m_status == STATUS_PENDING) {
@@ -356,9 +355,10 @@
m_config.m_statusUpdateCallback(certRequest);
}
- contentTLV = CHALLENGE::encodeDataPayload(certRequest);
- contentTLV.push_back(makeNestedBlock(tlv_issued_cert_name, issuedCert.getName()));
- contentTLV.parse();
+ payload = CHALLENGE::encodeDataPayload(certRequest);
+ payload.parse();
+ payload.push_back(makeNestedBlock(tlv_issued_cert_name, issuedCert.getName()));
+ payload.encode();
//contentJson.add(JSON_CA_CERT_ID, readString(issuedCert.getName().at(-1)));
_LOG_TRACE("Challenge succeeded. Certificate has been issued");
@@ -371,7 +371,7 @@
_LOG_TRACE("Cannot update request instance: " << e.what());
return;
}
- contentTLV = CHALLENGE::encodeDataPayload(certRequest);
+ payload = CHALLENGE::encodeDataPayload(certRequest);
_LOG_TRACE("No failure no success. Challenge moves on");
}
}
@@ -381,9 +381,9 @@
result.setFreshnessPeriod(DEFAULT_DATA_FRESHNESS_PERIOD);
// encrypt the content
- auto payload = contentTLV.getBuffer();
- auto contentBlock = encodeBlockWithAesGcm128(tlv::Content, m_aesKey, payload->data(),
- payload->size(), (uint8_t*)"test", strlen("test"));
+ auto payloadBuffer = payload.getBuffer();
+ auto contentBlock = encodeBlockWithAesGcm128(tlv::Content, m_aesKey, payloadBuffer->data(),
+ payloadBuffer->size(), (uint8_t*)"test", strlen("test"));
result.setContent(contentBlock);
m_keyChain.sign(result, signingByIdentity(m_config.m_caName));
m_face.put(result);
diff --git a/src/challenge-module/challenge-credential.cpp b/src/challenge-module/challenge-credential.cpp
index a4ca557..16724bc 100644
--- a/src/challenge-module/challenge-credential.cpp
+++ b/src/challenge-module/challenge-credential.cpp
@@ -80,6 +80,7 @@
void
ChallengeCredential::handleChallengeRequest(const Block& params, CertificateRequest& request)
{
+ params.parse();
if (m_trustAnchors.empty()) {
parseConfigFile();
}
@@ -174,10 +175,8 @@
else {
_LOG_ERROR("Client's status and challenge status are wrong");
}
- request.parse();
+ request.encode();
return request;
}
-
-
} // namespace ndncert
} // namespace ndn
diff --git a/src/challenge-module/challenge-email.cpp b/src/challenge-module/challenge-email.cpp
index db069c8..4ec3c6f 100644
--- a/src/challenge-module/challenge-email.cpp
+++ b/src/challenge-module/challenge-email.cpp
@@ -50,6 +50,7 @@
void
ChallengeEmail::handleChallengeRequest(const Block& params, CertificateRequest& request)
{
+ params.parse();
auto currentTime = time::system_clock::now();
if (request.m_challengeStatus == "") {
// for the first time, init the challenge
@@ -200,7 +201,7 @@
else {
_LOG_ERROR("Client's status and challenge status are wrong");
}
- request.parse();
+ request.encode();
return request;
}
diff --git a/src/challenge-module/challenge-pin.cpp b/src/challenge-module/challenge-pin.cpp
index f31ca77..e809213 100644
--- a/src/challenge-module/challenge-pin.cpp
+++ b/src/challenge-module/challenge-pin.cpp
@@ -44,6 +44,7 @@
void
ChallengePin::handleChallengeRequest(const Block& params, CertificateRequest& request)
{
+ params.parse();
auto currentTime = time::system_clock::now();
if (request.m_challengeStatus == "") {
_LOG_TRACE("Challenge Interest arrives. Init the challenge");
@@ -172,7 +173,7 @@
else {
_LOG_ERROR("Client's status and challenge status are wrong");
}
- request.parse();
+ request.encode();
return request;
}
} // namespace ndncert
diff --git a/src/client-config.cpp b/src/client-config.cpp
index 47115bb..2aab26c 100644
--- a/src/client-config.cpp
+++ b/src/client-config.cpp
@@ -102,28 +102,6 @@
return item;
}
-ClientCaItem
-ClientConfig::extractCaItem(const Block& contentBlock)
-{
- ClientCaItem item;
- item.m_caName = Name(readString(contentBlock.get(tlv_ca_prefix)));
- if (item.m_caName.empty()) {
- BOOST_THROW_EXCEPTION(Error("Cannot read ca-prefix from the config file"));
- }
- item.m_caInfo = readString(contentBlock.get(tlv_ca_info));
- // item.m_probe = configSection.get("probe", "");
-
- if (!contentBlock.get(tlv_ca_certificate).hasValue()) {
- BOOST_THROW_EXCEPTION(Error("Cannot load the certificate from config file"));
- }
-
- security::v2::Certificate anchor;
- anchor.wireDecode(contentBlock.get(tlv_ca_certificate));
- item.m_anchor = anchor;
-
- return item;
-}
-
void
ClientConfig::removeCaItem(const Name& caName)
{
diff --git a/src/client-config.hpp b/src/client-config.hpp
index 876535d..0195c48 100644
--- a/src/client-config.hpp
+++ b/src/client-config.hpp
@@ -106,9 +106,6 @@
static ClientCaItem
extractCaItem(const JsonSection& configSection);
- static ClientCaItem
- extractCaItem(const Block& configSection);
-
public:
std::list<ClientCaItem> m_caItems;
std::string m_localNdncertAnchor;
diff --git a/src/client-module.cpp b/src/client-module.cpp
index 7049961..adad5d9 100644
--- a/src/client-module.cpp
+++ b/src/client-module.cpp
@@ -123,6 +123,7 @@
}
auto contentTLV = reply.getContent();
+ contentTLV.parse();
// read the available name and put it into the state
if (contentTLV.get(tlv_probe_response).hasValue()) {
@@ -216,6 +217,7 @@
return std::list<std::string>();
}
auto contentTLV = reply.getContent();
+ contentTLV.parse();
// ECDH
const auto& peerKeyBase64Str = readString(contentTLV.get(tlv_ecdh_pub));
@@ -242,8 +244,9 @@
shared_ptr<Interest>
ClientModule::generateChallengeInterest(const Block& challengeRequest)
{
+ challengeRequest.parse();
m_challengeType = readString(challengeRequest.get(tlv_selected_challenge));
-
+
Name interestName = m_ca.m_caName;
interestName.append("CA").append("CHALLENGE").append(m_requestId);
auto interest = make_shared<Interest>(interestName);
@@ -251,8 +254,8 @@
interest->setCanBePrefix(false);
// encrypt the Interest parameters
- auto payload = challengeRequest.getBuffer();
- auto paramBlock = encodeBlockWithAesGcm128(tlv::ApplicationParameters, m_aesKey,
+ auto payload = challengeRequest.get(tlv_encrypted_payload).getBuffer();
+ auto paramBlock = encodeBlockWithAesGcm128(tlv_encrypted_payload, m_aesKey,
payload->data(), payload->size(), (const uint8_t*)"test", strlen("test"));
interest->setApplicationParameters(paramBlock);
@@ -268,10 +271,9 @@
return;
}
auto result = decodeBlockWithAesGcm128(reply.getContent(), m_aesKey, (const uint8_t*)"test", strlen("test"));
- bool isSuccess;
- Block contentTLV;
- std::tie<bool, Block>(isSuccess, contentTLV) = Block::fromBuffer(result.data(), result.size());
+ Block contentTLV = makeBinaryBlock(tlv_encrypted_payload, result.data(), result.size());
+ contentTLV.parse();
// update state
m_status = readNonNegativeInteger(contentTLV.get(tlv_status));
diff --git a/src/protocol-detail/challenge.cpp b/src/protocol-detail/challenge.cpp
index f1fed27..273e631 100644
--- a/src/protocol-detail/challenge.cpp
+++ b/src/protocol-detail/challenge.cpp
@@ -33,7 +33,7 @@
makeStringBlock(tlv_challenge_status, request.m_challengeStatus);
makeNonNegativeIntegerBlock(tlv_remaining_tries, request.m_remainingTries);
makeNonNegativeIntegerBlock(tlv_remaining_time, request.m_remainingTime);
- response.parse();
+ response.encode();
return response;
}
diff --git a/src/protocol-detail/info.cpp b/src/protocol-detail/info.cpp
index 1463e04..fb2cce5 100644
--- a/src/protocol-detail/info.cpp
+++ b/src/protocol-detail/info.cpp
@@ -41,7 +41,7 @@
}
content.push_back(makeNonNegativeIntegerBlock(tlv_max_validity_period, caConfig.m_maxValidityPeriod.count()));
content.push_back(makeNestedBlock(tlv_ca_certificate, certificate));
- content.parse();
+ content.encode();
return content;
}
diff --git a/src/protocol-detail/new.cpp b/src/protocol-detail/new.cpp
index 27bbf0a..20eaafb 100644
--- a/src/protocol-detail/new.cpp
+++ b/src/protocol-detail/new.cpp
@@ -50,7 +50,7 @@
request.push_back(makeStringBlock(tlv_ecdh_pub, ecdhPub));
request.push_back(makeNestedBlock(tlv_cert_request, certRequest));
- request.parse();
+ request.encode();
return request;
}
@@ -67,7 +67,7 @@
for (const auto& entry: challenges) {
response.push_back(makeStringBlock(tlv_challenge, entry));
}
- response.parse();
+ response.encode();
return response;
}
diff --git a/src/protocol-detail/probe.cpp b/src/protocol-detail/probe.cpp
index b8034b1..f8a561d 100644
--- a/src/protocol-detail/probe.cpp
+++ b/src/protocol-detail/probe.cpp
@@ -62,7 +62,7 @@
makeStringBlock(tlv_parameter_value, arguments.at(i))
);
}
- content.parse();
+ content.encode();
return content;
}
@@ -91,7 +91,7 @@
// TODO: Must be determined based on CA config
content.push_back(makeEmptyBlock(tlv_allow_longer_name));
- content.parse();
+ content.encode();
return content;
}
diff --git a/tests/unit-tests/ca-module.t.cpp b/tests/unit-tests/ca-module.t.cpp
index 81a5916..13abf4b 100644
--- a/tests/unit-tests/ca-module.t.cpp
+++ b/tests/unit-tests/ca-module.t.cpp
@@ -40,7 +40,7 @@
{
util::DummyClientFace face(io, {true, true});
CaModule ca(face, m_keyChain, "tests/unit-tests/ca.conf.test", "ca-storage-memory");
- BOOST_CHECK_EQUAL(ca.getCaConf().m_caName, "/ndn");
+ BOOST_CHECK_EQUAL(ca.getCaConf().m_caPrefix, "/ndn");
auto identity = addIdentity(Name("/ndn/site2"));
auto key = identity.getDefaultKey();
@@ -61,23 +61,27 @@
util::DummyClientFace face(io, {true, true});
CaModule ca(face, m_keyChain, "tests/unit-tests/ca.conf.test", "ca-storage-memory");
- ca.setProbeHandler([&] (const JsonSection& probeInfo) {
+ ca.setProbeHandler([&] (const Block& probeInfo) {
return "example";
});
advanceClocks(time::milliseconds(20), 60);
Interest interest("/ndn/CA/PROBE");
interest.setCanBePrefix(false);
- JsonSection paramJson;
- paramJson.add(JSON_CLIENT_PROBE_INFO, "zhiyi");
- interest.setApplicationParameters(ClientModule::paramFromJson(paramJson));
+
+ Block paramTLV = makeEmptyBlock(tlv::ApplicationParameters);
+ paramTLV.push_back(makeStringBlock(tlv_parameter_key, JSON_CLIENT_PROBE_INFO));
+ paramTLV.push_back(makeStringBlock(tlv_parameter_value, "zhiyi"));
+ paramTLV.encode();
+ interest.setApplicationParameters(paramTLV);
int count = 0;
face.onSendData.connect([&] (const Data& response) {
count++;
BOOST_CHECK(security::verifySignature(response, cert));
- auto contentJson = ClientModule::getJsonFromData(response);
- BOOST_CHECK_EQUAL(contentJson.get<std::string>(JSON_CA_NAME), "/ndn/example");
+ Block contentBlock = response.getContent();
+ contentBlock.parse();
+ BOOST_CHECK_EQUAL(readString(contentBlock.get(tlv_ca_prefix)), "/ndn/example");
});
face.receive(interest);
@@ -93,7 +97,7 @@
util::DummyClientFace face(io, {true, true});
CaModule ca(face, m_keyChain, "tests/unit-tests/ca.conf.test", "ca-storage-memory");
- ca.setProbeHandler([&] (const JsonSection& probeInfo) {
+ ca.setProbeHandler([&] (const Block& probeInfo) {
return "example";
});
advanceClocks(time::milliseconds(20), 60);
@@ -287,7 +291,7 @@
auto contentJson = ClientModule::getJsonFromData(response);
client.onNewResponse(response);
auto paramJson = pinChallenge.getRequirementForChallenge(client.m_status, client.m_challengeStatus);
- challengeInterest = client.generateChallengeInterest(pinChallenge.genChallengeRequestJson(client.m_status,
+ challengeInterest = client.generateChallengeInterest(pinChallenge.genChallengeRequestTLV(client.m_status,
client.m_challengeStatus,
paramJson));
}
@@ -300,7 +304,7 @@
BOOST_CHECK_EQUAL(client.m_challengeStatus, ChallengePin::NEED_CODE);
auto paramJson = pinChallenge.getRequirementForChallenge(client.m_status, client.m_challengeStatus);
- challengeInterest2 = client.generateChallengeInterest(pinChallenge.genChallengeRequestJson(client.m_status,
+ challengeInterest2 = client.generateChallengeInterest(pinChallenge.genChallengeRequestTLV(client.m_status,
client.m_challengeStatus,
paramJson));
}
@@ -319,7 +323,7 @@
if (i.first == ChallengePin::JSON_PIN_CODE)
i.second.put("", secret);
}
- challengeInterest3 = client.generateChallengeInterest(pinChallenge.genChallengeRequestJson(client.m_status,
+ challengeInterest3 = client.generateChallengeInterest(pinChallenge.genChallengeRequestTLV(client.m_status,
client.m_challengeStatus,
paramJson));
}
diff --git a/tests/unit-tests/challenge-credential.t.cpp b/tests/unit-tests/challenge-credential.t.cpp
index 2455e73..9072fa0 100644
--- a/tests/unit-tests/challenge-credential.t.cpp
+++ b/tests/unit-tests/challenge-credential.t.cpp
@@ -78,19 +78,22 @@
ss.str("");
ss.clear();
- JsonSection params;
io::save<security::v2::Certificate>(selfSigned, ss);
std::string selfSignedStr = ss.str();
- params.add(ChallengeCredential::JSON_CREDENTIAL_SELF, selfSignedStr);
ss.str("");
ss.clear();
io::save<security::v2::Certificate>(certB, ss);
std::string credentialStr = ss.str();
- params.add(ChallengeCredential::JSON_CREDENTIAL_CERT, credentialStr);
ss.str("");
ss.clear();
+ Block params = makeEmptyBlock(tlv_encrypted_payload);
+ params.push_back(makeStringBlock(tlv_parameter_key, ChallengeCredential::JSON_CREDENTIAL_SELF));
+ params.push_back(makeStringBlock(tlv_parameter_value, selfSignedStr));
+ params.push_back(makeStringBlock(tlv_parameter_key, ChallengeCredential::JSON_CREDENTIAL_CERT));
+ params.push_back(makeStringBlock(tlv_parameter_value, credentialStr));
+
challenge.handleChallengeRequest(params, request);
BOOST_CHECK_EQUAL(request.m_status, STATUS_PENDING);
BOOST_CHECK_EQUAL(request.m_challengeStatus, CHALLENGE_STATUS_SUCCESS);
diff --git a/tests/unit-tests/challenge-email.t.cpp b/tests/unit-tests/challenge-email.t.cpp
index 398df97..834411d 100644
--- a/tests/unit-tests/challenge-email.t.cpp
+++ b/tests/unit-tests/challenge-email.t.cpp
@@ -48,11 +48,12 @@
auto cert = key.getDefaultCertificate();
CertificateRequest request(Name("/ndn/site1"), "123", STATUS_BEFORE_CHALLENGE, cert);
- JsonSection emailJson;
- emailJson.put(ChallengeEmail::JSON_EMAIL, "zhiyi@cs.ucla.edu");
+ Block paramTLV = makeEmptyBlock(tlv_encrypted_payload);
+ paramTLV.push_back(makeStringBlock(tlv_parameter_key, ChallengeEmail::JSON_EMAIL));
+ paramTLV.push_back(makeStringBlock(tlv_parameter_value, "zhiyi@cs.ucla.edu"));
ChallengeEmail challenge("./tests/unit-tests/test-send-email.sh");
- challenge.handleChallengeRequest(emailJson, request);
+ challenge.handleChallengeRequest(paramTLV, request);
BOOST_CHECK_EQUAL(request.m_status, STATUS_CHALLENGE);
BOOST_CHECK_EQUAL(request.m_challengeStatus, ChallengeEmail::NEED_CODE);
@@ -97,11 +98,12 @@
auto cert = key.getDefaultCertificate();
CertificateRequest request(Name("/ndn/site1"), "123", STATUS_BEFORE_CHALLENGE, cert);
- JsonSection emailJson;
- emailJson.put(ChallengeEmail::JSON_EMAIL, "zhiyi@cs");
+ Block paramTLV = makeEmptyBlock(tlv_encrypted_payload);
+ paramTLV.push_back(makeStringBlock(tlv_parameter_key, ChallengeEmail::JSON_EMAIL));
+ paramTLV.push_back(makeStringBlock(tlv_parameter_value, "zhiyi@cs"));
ChallengeEmail challenge;
- challenge.handleChallengeRequest(emailJson, request);
+ challenge.handleChallengeRequest(paramTLV, request);
BOOST_CHECK_EQUAL(request.m_challengeStatus, ChallengeEmail::FAILURE_INVALID_EMAIL);
BOOST_CHECK_EQUAL(request.m_status, STATUS_FAILURE);
@@ -117,11 +119,12 @@
CertificateRequest request(Name("/ndn/site1"), "123", STATUS_CHALLENGE, ChallengeEmail::NEED_CODE,
"Email", time::toIsoString(time::system_clock::now()), 3600, 3, json, cert);
- JsonSection requestJson;
- requestJson.put(ChallengeEmail::JSON_CODE, "4567");
+ Block paramTLV = makeEmptyBlock(tlv_encrypted_payload);
+ paramTLV.push_back(makeStringBlock(tlv_parameter_key, ChallengeEmail::JSON_CODE));
+ paramTLV.push_back(makeStringBlock(tlv_parameter_value, "4567"));
ChallengeEmail challenge;
- challenge.handleChallengeRequest(requestJson, request);
+ challenge.handleChallengeRequest(paramTLV, request);
BOOST_CHECK_EQUAL(request.m_challengeStatus, CHALLENGE_STATUS_SUCCESS);
BOOST_CHECK_EQUAL(request.m_status, STATUS_PENDING);
@@ -138,11 +141,12 @@
CertificateRequest request(Name("/ndn/site1"), "123", STATUS_CHALLENGE, ChallengeEmail::NEED_CODE,
"email", time::toIsoString(time::system_clock::now()), 3600, 3, json, cert);
- JsonSection requestJson;
- requestJson.put(ChallengeEmail::JSON_CODE, "7890");
+ Block paramTLV = makeEmptyBlock(tlv_encrypted_payload);
+ paramTLV.push_back(makeStringBlock(tlv_parameter_key, ChallengeEmail::JSON_CODE));
+ paramTLV.push_back(makeStringBlock(tlv_parameter_value, "7890"));
ChallengeEmail challenge;
- challenge.handleChallengeRequest(requestJson, request);
+ challenge.handleChallengeRequest(paramTLV, request);
BOOST_CHECK_EQUAL(request.m_challengeStatus, ChallengeEmail::WRONG_CODE);
BOOST_CHECK_EQUAL(request.m_status, STATUS_CHALLENGE);
diff --git a/tests/unit-tests/challenge-pin.t.cpp b/tests/unit-tests/challenge-pin.t.cpp
index adac6b9..81ee1e1 100644
--- a/tests/unit-tests/challenge-pin.t.cpp
+++ b/tests/unit-tests/challenge-pin.t.cpp
@@ -42,7 +42,7 @@
CertificateRequest request(Name("/ndn/site1"), "123", STATUS_BEFORE_CHALLENGE, cert);
ChallengePin challenge;
- challenge.handleChallengeRequest(JsonSection(), request);
+ challenge.handleChallengeRequest(makeEmptyBlock(tlv_encrypted_payload), request);
BOOST_CHECK_EQUAL(request.m_status, STATUS_CHALLENGE);
BOOST_CHECK_EQUAL(request.m_challengeStatus, ChallengePin::NEED_CODE);
@@ -59,11 +59,12 @@
CertificateRequest request(Name("/ndn/site1"), "123", STATUS_CHALLENGE, ChallengePin::NEED_CODE, "pin",
time::toIsoString(time::system_clock::now()), 3600, 3, secret, cert);
- JsonSection paramJson;
- paramJson.put(ChallengePin::JSON_PIN_CODE, "12345");
+ Block paramTLV = makeEmptyBlock(tlv_encrypted_payload);
+ paramTLV.push_back(makeStringBlock(tlv_parameter_key, ChallengePin::JSON_PIN_CODE));
+ paramTLV.push_back(makeStringBlock(tlv_parameter_value, "12345"));
ChallengePin challenge;
- challenge.handleChallengeRequest(paramJson, request);
+ challenge.handleChallengeRequest(paramTLV, request);
BOOST_CHECK_EQUAL(request.m_status, STATUS_PENDING);
BOOST_CHECK_EQUAL(request.m_challengeStatus, CHALLENGE_STATUS_SUCCESS);
@@ -80,11 +81,12 @@
CertificateRequest request(Name("/ndn/site1"), "123", STATUS_CHALLENGE, ChallengePin::NEED_CODE, "pin",
time::toIsoString(time::system_clock::now()), 3600, 3, secret, cert);
- JsonSection paramJson;
- paramJson.put(ChallengePin::JSON_PIN_CODE, "45678");
+ Block paramTLV = makeEmptyBlock(tlv_encrypted_payload);
+ paramTLV.push_back(makeStringBlock(tlv_parameter_key, ChallengePin::JSON_PIN_CODE));
+ paramTLV.push_back(makeStringBlock(tlv_parameter_value, "45678"));
ChallengePin challenge;
- challenge.handleChallengeRequest(paramJson, request);
+ challenge.handleChallengeRequest(paramTLV, request);
BOOST_CHECK_EQUAL(request.m_status, STATUS_CHALLENGE);
BOOST_CHECK_EQUAL(request.m_challengeStatus, ChallengePin::WRONG_CODE);