fix cr
Change-Id: I683943c014a8615711bd8a7b570acfe8d3b51a3e
diff --git a/src/ca-module.cpp b/src/ca-module.cpp
index ee55132..89cddcf 100644
--- a/src/ca-module.cpp
+++ b/src/ca-module.cpp
@@ -321,9 +321,9 @@
result.setName(request.getName());
result.setFreshnessPeriod(DEFAULT_DATA_FRESHNESS_PERIOD);
result.setContent(requesttlv::encodeDataContent(myEcdhPubKeyBase64,
- salt,
- requestState.m_requestId, requestState.m_status,
- m_config.m_caProfile.m_supportedChallenges));
+ salt,
+ requestState.requestId, requestState.status,
+ m_config.m_caProfile.m_supportedChallenges));
m_keyChain.sign(result, signingByIdentity( m_config.m_caProfile.m_caPrefix));
m_face.put(result);
if (m_statusUpdateCallback) {
@@ -343,7 +343,7 @@
return;
}
// verify signature
- if (!security::verifySignature(request, requestState->m_cert)) {
+ if (!security::verifySignature(request, requestState->cert)) {
NDN_LOG_ERROR("Invalid Signature in the Interest packet.");
m_face.put(generateErrorDataPacket(request.getName(), ErrorCode::BAD_SIGNATURE,
"Invalid Signature in the Interest packet."));
@@ -353,20 +353,20 @@
Buffer paramTLVPayload;
try {
paramTLVPayload = decodeBlockWithAesGcm128(request.getApplicationParameters(),
- requestState->m_encryptionKey.data(),
- requestState->m_requestId.data(),
- requestState->m_requestId.size());
+ requestState->encryptionKey.data(),
+ requestState->requestId.data(),
+ requestState->requestId.size());
}
catch (const std::exception& e) {
NDN_LOG_ERROR("Interest paramaters decryption failed: " << e.what());
- m_storage->deleteRequest(requestState->m_requestId);
+ m_storage->deleteRequest(requestState->requestId);
m_face.put(generateErrorDataPacket(request.getName(), ErrorCode::INVALID_PARAMETER,
"Interest paramaters decryption failed."));
return;
}
if (paramTLVPayload.size() == 0) {
NDN_LOG_ERROR("No parameters are found after decryption.");
- m_storage->deleteRequest(requestState->m_requestId);
+ m_storage->deleteRequest(requestState->requestId);
m_face.put(generateErrorDataPacket(request.getName(), ErrorCode::INVALID_PARAMETER,
"No parameters are found after decryption."));
return;
@@ -379,7 +379,7 @@
auto challenge = ChallengeModule::createChallengeModule(challengeType);
if (challenge == nullptr) {
NDN_LOG_TRACE("Unrecognized challenge type: " << challengeType);
- m_storage->deleteRequest(requestState->m_requestId);
+ m_storage->deleteRequest(requestState->requestId);
m_face.put(generateErrorDataPacket(request.getName(), ErrorCode::INVALID_PARAMETER, "Unrecognized challenge type."));
return;
}
@@ -387,26 +387,26 @@
NDN_LOG_TRACE("CHALLENGE module to be load: " << challengeType);
auto errorInfo = challenge->handleChallengeRequest(paramTLV, *requestState);
if (std::get<0>(errorInfo) != ErrorCode::NO_ERROR) {
- m_storage->deleteRequest(requestState->m_requestId);
+ m_storage->deleteRequest(requestState->requestId);
m_face.put(generateErrorDataPacket(request.getName(), std::get<0>(errorInfo), std::get<1>(errorInfo)));
return;
}
Block payload;
- if (requestState->m_status == Status::PENDING) {
+ if (requestState->status == Status::PENDING) {
// if challenge succeeded
- if (requestState->m_requestType == RequestType::NEW) {
+ if (requestState->requestType == RequestType::NEW) {
auto issuedCert = issueCertificate(*requestState);
- requestState->m_cert = issuedCert;
- requestState->m_status = Status::SUCCESS;
- m_storage->deleteRequest(requestState->m_requestId);
+ requestState->cert = issuedCert;
+ requestState->status = Status::SUCCESS;
+ m_storage->deleteRequest(requestState->requestId);
payload = challengetlv::encodeDataContent(*requestState, issuedCert.getName());
NDN_LOG_TRACE("Challenge succeeded. Certificate has been issued: " << issuedCert.getName());
}
- else if (requestState->m_requestType == RequestType::REVOKE) {
- requestState->m_status = Status::SUCCESS;
- m_storage->deleteRequest(requestState->m_requestId);
+ else if (requestState->requestType == RequestType::REVOKE) {
+ requestState->status = Status::SUCCESS;
+ m_storage->deleteRequest(requestState->requestId);
payload = challengetlv::encodeDataContent(*requestState);
NDN_LOG_TRACE("Challenge succeeded. Certificate has been revoked");
@@ -432,15 +432,15 @@
security::Certificate
CaModule::issueCertificate(const RequestState& requestState)
{
- auto expectedPeriod = requestState.m_cert.getValidityPeriod().getPeriod();
+ auto expectedPeriod = requestState.cert.getValidityPeriod().getPeriod();
security::ValidityPeriod period(expectedPeriod.first, expectedPeriod.second);
security::Certificate newCert;
- Name certName = requestState.m_cert.getKeyName();
+ Name certName = requestState.cert.getKeyName();
certName.append("NDNCERT").append(std::to_string(random::generateSecureWord64()));
newCert.setName(certName);
- newCert.setContent(requestState.m_cert.getContent());
- NDN_LOG_TRACE("cert request content " << requestState.m_cert);
+ newCert.setContent(requestState.cert.getContent());
+ NDN_LOG_TRACE("cert request content " << requestState.cert);
SignatureInfo signatureInfo;
signatureInfo.setValidityPeriod(period);
security::SigningInfo signingInfo(security::SigningInfo::SIGNER_TYPE_ID,
diff --git a/src/challenge/challenge-credential.cpp b/src/challenge/challenge-credential.cpp
index a9ebe1c..cac5aa0 100644
--- a/src/challenge/challenge-credential.cpp
+++ b/src/challenge/challenge-credential.cpp
@@ -111,7 +111,7 @@
for (auto anchor : m_trustAnchors) {
if (anchor.getKeyName() == signingKeyName) {
if (security::verifySignature(credential, anchor) &&
- security::verifySignature(request.m_requestId.data(), request.m_requestId.size(), signature, signatureLen, key)) {
+ security::verifySignature(request.requestId.data(), request.requestId.size(), signature, signatureLen, key)) {
return returnWithSuccess(request);
}
}
diff --git a/src/challenge/challenge-email.cpp b/src/challenge/challenge-email.cpp
index 8b08d82..ba0a0e8 100644
--- a/src/challenge/challenge-email.cpp
+++ b/src/challenge/challenge-email.cpp
@@ -48,13 +48,13 @@
{
params.parse();
auto currentTime = time::system_clock::now();
- if (request.m_status == Status::BEFORE_CHALLENGE) {
+ if (request.status == Status::BEFORE_CHALLENGE) {
// for the first time, init the challenge
std::string emailAddress = readString(params.get(tlv::ParameterValue));
if (!isValidEmailAddress(emailAddress)) {
return returnWithNewChallengeStatus(request, INVALID_EMAIL, JsonSection(), m_maxAttemptTimes - 1, m_secretLifetime);
}
- auto lastComponentRequested = readString(request.m_cert.getIdentity().get(-1));
+ auto lastComponentRequested = readString(request.cert.getIdentity().get(-1));
if (lastComponentRequested != emailAddress) {
NDN_LOG_TRACE("Email and requested name do not match. Email " << emailAddress << "requested last component "
<< lastComponentRequested);
@@ -64,18 +64,18 @@
secretJson.add(PARAMETER_KEY_CODE, emailCode);
// send out the email
sendEmail(emailAddress, emailCode, request);
- NDN_LOG_TRACE("Secret for request " << toHex(request.m_requestId.data(), request.m_requestId.size()) << " : " << emailCode);
+ NDN_LOG_TRACE("Secret for request " << toHex(request.requestId.data(), request.requestId.size()) << " : " << emailCode);
return returnWithNewChallengeStatus(request, NEED_CODE, std::move(secretJson), m_maxAttemptTimes, m_secretLifetime);
}
- if (request.m_challengeState) {
- if (request.m_challengeState->m_challengeStatus == NEED_CODE ||
- request.m_challengeState->m_challengeStatus == WRONG_CODE) {
- NDN_LOG_TRACE("Challenge Interest arrives. Challenge Status: " << request.m_challengeState->m_challengeStatus);
+ if (request.challengeState) {
+ if (request.challengeState->challengeStatus == NEED_CODE ||
+ request.challengeState->challengeStatus == WRONG_CODE) {
+ NDN_LOG_TRACE("Challenge Interest arrives. Challenge Status: " << request.challengeState->challengeStatus);
// the incoming interest should bring the pin code
std::string givenCode = readString(params.get(tlv::ParameterValue));
- auto secret = request.m_challengeState->m_secrets;
+ auto secret = request.challengeState->secrets;
// check if run out of time
- if (currentTime - request.m_challengeState->m_timestamp >= m_secretLifetime) {
+ if (currentTime - request.challengeState->timestamp >= m_secretLifetime) {
return returnWithError(request, ErrorCode::OUT_OF_TIME, "Secret expired.");
}
// check if provided secret is correct
@@ -85,11 +85,11 @@
return returnWithSuccess(request);
}
// otherwise, check remaining attempt times
- if (request.m_challengeState->m_remainingTries > 1) {
- auto remainTime = m_secretLifetime - (currentTime - request.m_challengeState->m_timestamp);
+ if (request.challengeState->remainingTries > 1) {
+ auto remainTime = m_secretLifetime - (currentTime - request.challengeState->timestamp);
NDN_LOG_TRACE("Wrong secret code provided. Remaining Tries - 1.");
return returnWithNewChallengeStatus(request, WRONG_CODE, std::move(secret),
- request.m_challengeState->m_remainingTries - 1,
+ request.challengeState->remainingTries - 1,
time::duration_cast<time::seconds>(remainTime));
}
else {
@@ -164,8 +164,8 @@
{
std::string command = m_sendEmailScript;
command += " \"" + emailAddress + "\" \"" + secret + "\" \"" +
- request.m_caPrefix.toUri() + "\" \"" +
- request.m_cert.getName().toUri() + "\"";
+ request.caPrefix.toUri() + "\" \"" +
+ request.cert.getName().toUri() + "\"";
boost::process::child child(command);
child.wait();
if (child.exit_code() != 0) {
diff --git a/src/challenge/challenge-module.cpp b/src/challenge/challenge-module.cpp
index 8de88b6..708cbb6 100644
--- a/src/challenge/challenge-module.cpp
+++ b/src/challenge/challenge-module.cpp
@@ -75,9 +75,9 @@
std::tuple<ErrorCode, std::string>
ChallengeModule::returnWithError(ca::RequestState& request, ErrorCode errorCode, std::string&& errorInfo)
{
- request.m_status = Status::FAILURE;
- request.m_challengeType = "";
- request.m_challengeState = nullopt;
+ request.status = Status::FAILURE;
+ request.challengeType = "";
+ request.challengeState = nullopt;
return std::make_tuple(errorCode, std::move(errorInfo));
}
@@ -85,19 +85,19 @@
ChallengeModule::returnWithNewChallengeStatus(ca::RequestState& request, const std::string& challengeStatus,
JsonSection&& challengeSecret, size_t remainingTries, time::seconds remainingTime)
{
- request.m_status = Status::CHALLENGE;
- request.m_challengeType = CHALLENGE_TYPE;
- request.m_challengeState = ca::ChallengeState(challengeStatus, time::system_clock::now(), remainingTries, remainingTime,
- std::move(challengeSecret));
+ request.status = Status::CHALLENGE;
+ request.challengeType = CHALLENGE_TYPE;
+ request.challengeState = ca::ChallengeState(challengeStatus, time::system_clock::now(), remainingTries, remainingTime,
+ std::move(challengeSecret));
return std::make_tuple(ErrorCode::NO_ERROR, "");
}
std::tuple<ErrorCode, std::string>
ChallengeModule::returnWithSuccess(ca::RequestState& request)
{
- request.m_status = Status::PENDING;
- request.m_challengeType = CHALLENGE_TYPE;
- request.m_challengeState = nullopt;
+ request.status = Status::PENDING;
+ request.challengeType = CHALLENGE_TYPE;
+ request.challengeState = nullopt;
return std::make_tuple(ErrorCode::NO_ERROR, "");
}
diff --git a/src/challenge/challenge-pin.cpp b/src/challenge/challenge-pin.cpp
index 1ae6753..26e5317 100644
--- a/src/challenge/challenge-pin.cpp
+++ b/src/challenge/challenge-pin.cpp
@@ -42,23 +42,23 @@
{
params.parse();
auto currentTime = time::system_clock::now();
- if (request.m_status == Status::BEFORE_CHALLENGE) {
+ if (request.status == Status::BEFORE_CHALLENGE) {
NDN_LOG_TRACE("Challenge Interest arrives. Init the challenge");
// for the first time, init the challenge
std::string secretCode = generateSecretCode();
JsonSection secretJson;
secretJson.add(PARAMETER_KEY_CODE, secretCode);
- NDN_LOG_TRACE("Secret for request " << toHex(request.m_requestId.data(), request.m_requestId.size()) << " : " << secretCode);
+ NDN_LOG_TRACE("Secret for request " << toHex(request.requestId.data(), request.requestId.size()) << " : " << secretCode);
return returnWithNewChallengeStatus(request, NEED_CODE, std::move(secretJson), m_maxAttemptTimes, m_secretLifetime);
}
- if (request.m_challengeState) {
- if (request.m_challengeState->m_challengeStatus == NEED_CODE ||
- request.m_challengeState->m_challengeStatus == WRONG_CODE) {
- NDN_LOG_TRACE("Challenge Interest arrives. Challenge Status: " << request.m_challengeState->m_challengeStatus);
+ if (request.challengeState) {
+ if (request.challengeState->challengeStatus == NEED_CODE ||
+ request.challengeState->challengeStatus == WRONG_CODE) {
+ NDN_LOG_TRACE("Challenge Interest arrives. Challenge Status: " << request.challengeState->challengeStatus);
// the incoming interest should bring the pin code
std::string givenCode = readString(params.get(tlv::ParameterValue));
- auto secret = request.m_challengeState->m_secrets;
- if (currentTime - request.m_challengeState->m_timestamp >= m_secretLifetime) {
+ auto secret = request.challengeState->secrets;
+ if (currentTime - request.challengeState->timestamp >= m_secretLifetime) {
return returnWithError(request, ErrorCode::OUT_OF_TIME, "Secret expired.");
}
if (givenCode == secret.get<std::string>(PARAMETER_KEY_CODE)) {
@@ -66,11 +66,11 @@
return returnWithSuccess(request);
}
// check rest attempt times
- if (request.m_challengeState->m_remainingTries > 1) {
- auto remainTime = m_secretLifetime - (currentTime - request.m_challengeState->m_timestamp);
+ if (request.challengeState->remainingTries > 1) {
+ auto remainTime = m_secretLifetime - (currentTime - request.challengeState->timestamp);
NDN_LOG_TRACE("Wrong PIN code provided. Remaining Tries - 1.");
return returnWithNewChallengeStatus(request, WRONG_CODE, std::move(secret),
- request.m_challengeState->m_remainingTries - 1,
+ request.challengeState->remainingTries - 1,
time::duration_cast<time::seconds>(remainTime));
}
else {
diff --git a/src/detail/ca-memory.cpp b/src/detail/ca-memory.cpp
index f2a3b12..48a0903 100644
--- a/src/detail/ca-memory.cpp
+++ b/src/detail/ca-memory.cpp
@@ -48,21 +48,21 @@
void
CaMemory::addRequest(const RequestState& request)
{
- auto search = m_requests.find(request.m_requestId);
+ auto search = m_requests.find(request.requestId);
if (search == m_requests.end()) {
- m_requests.insert(std::make_pair(request.m_requestId, request));
+ m_requests.insert(std::make_pair(request.requestId, request));
}
else {
- NDN_THROW(std::runtime_error("Request " + toHex(request.m_requestId.data(), request.m_requestId.size()) + " already exists"));
+ NDN_THROW(std::runtime_error("Request " + toHex(request.requestId.data(), request.requestId.size()) + " already exists"));
}
}
void
CaMemory::updateRequest(const RequestState& request)
{
- auto search = m_requests.find(request.m_requestId);
+ auto search = m_requests.find(request.requestId);
if (search == m_requests.end()) {
- m_requests.insert(std::make_pair(request.m_requestId, request));
+ m_requests.insert(std::make_pair(request.requestId, request));
}
else {
search->second = request;
@@ -73,7 +73,7 @@
CaMemory::deleteRequest(const RequestId& requestId)
{
auto search = m_requests.find(requestId);
- auto keyName = search->second.m_cert.getKeyName();
+ auto keyName = search->second.cert.getKeyName();
if (search != m_requests.end()) {
m_requests.erase(search);
}
@@ -94,7 +94,7 @@
{
std::list<RequestState> result;
for (const auto& entry : m_requests) {
- if (entry.second.m_caPrefix == caName) {
+ if (entry.second.caPrefix == caName) {
result.push_back(entry.second);
}
}
diff --git a/src/detail/ca-request-state.cpp b/src/detail/ca-request-state.cpp
index adb453f..55b5cf9 100644
--- a/src/detail/ca-request-state.cpp
+++ b/src/detail/ca-request-state.cpp
@@ -58,23 +58,23 @@
const time::system_clock::TimePoint& challengeTp,
size_t remainingTries, time::seconds remainingTime,
JsonSection&& challengeSecrets)
- : m_challengeStatus(challengeStatus)
- , m_timestamp(challengeTp)
- , m_remainingTries(remainingTries)
- , m_remainingTime(remainingTime)
- , m_secrets(std::move(challengeSecrets))
+ : challengeStatus(challengeStatus)
+ , timestamp(challengeTp)
+ , remainingTries(remainingTries)
+ , remainingTime(remainingTime)
+ , secrets(std::move(challengeSecrets))
{
}
RequestState::RequestState(const Name& caName, const RequestId& requestId, RequestType requestType, Status status,
const security::Certificate& cert, std::array<uint8_t, 16>&& encryptionKey, uint32_t aesBlockCounter)
- : m_caPrefix(caName)
- , m_requestId(requestId)
- , m_requestType(requestType)
- , m_status(status)
- , m_cert(cert)
- , m_encryptionKey(std::move(encryptionKey))
- , m_aesBlockCounter(aesBlockCounter)
+ : caPrefix(caName)
+ , requestId(requestId)
+ , requestType(requestType)
+ , status(status)
+ , cert(cert)
+ , encryptionKey(std::move(encryptionKey))
+ , aesBlockCounter(aesBlockCounter)
{
}
@@ -83,34 +83,34 @@
const std::string& challengeStatus, const time::system_clock::TimePoint& challengeTp,
size_t remainingTries, time::seconds remainingTime, JsonSection&& challengeSecrets,
std::array<uint8_t, 16>&& encryptionKey, uint32_t aesBlockCounter)
- : m_caPrefix(caName)
- , m_requestId(requestId)
- , m_requestType(requestType)
- , m_status(status)
- , m_cert(cert)
- , m_encryptionKey(std::move(encryptionKey))
- , m_aesBlockCounter(aesBlockCounter)
- , m_challengeType(challengeType)
- , m_challengeState(ChallengeState(challengeStatus, challengeTp, remainingTries, remainingTime, std::move(challengeSecrets)))
+ : caPrefix(caName)
+ , requestId(requestId)
+ , requestType(requestType)
+ , status(status)
+ , cert(cert)
+ , encryptionKey(std::move(encryptionKey))
+ , aesBlockCounter(aesBlockCounter)
+ , challengeType(challengeType)
+ , challengeState(ChallengeState(challengeStatus, challengeTp, remainingTries, remainingTime, std::move(challengeSecrets)))
{
}
std::ostream&
operator<<(std::ostream& os, const RequestState& request)
{
- os << "Request's CA name: " << request.m_caPrefix << "\n";
- os << "Request's request ID: " << toHex(request.m_requestId.data(), request.m_requestId.size()) << "\n";
- os << "Request's status: " << statusToString(request.m_status) << "\n";
- os << "Request's challenge type: " << request.m_challengeType << "\n";
- if (request.m_challengeState) {
- os << "Challenge Status: " << request.m_challengeState->m_challengeStatus << "\n";
- os << "Challenge remaining tries:" << request.m_challengeState->m_remainingTries << " times\n";
- os << "Challenge remaining time: " << request.m_challengeState->m_remainingTime.count() << " seconds\n";
- os << "Challenge last update: " << time::toIsoString(request.m_challengeState->m_timestamp) << "\n";
+ os << "Request's CA name: " << request.caPrefix << "\n";
+ os << "Request's request ID: " << toHex(request.requestId.data(), request.requestId.size()) << "\n";
+ os << "Request's status: " << statusToString(request.status) << "\n";
+ os << "Request's challenge type: " << request.challengeType << "\n";
+ if (request.challengeState) {
+ os << "Challenge Status: " << request.challengeState->challengeStatus << "\n";
+ os << "Challenge remaining tries:" << request.challengeState->remainingTries << " times\n";
+ os << "Challenge remaining time: " << request.challengeState->remainingTime.count() << " seconds\n";
+ os << "Challenge last update: " << time::toIsoString(request.challengeState->timestamp) << "\n";
}
os << "Certificate:\n";
util::IndentedStream os2(os, " ");
- os2 << request.m_cert;
+ os2 << request.cert;
return os;
}
diff --git a/src/detail/ca-request-state.hpp b/src/detail/ca-request-state.hpp
index 160760e..1857509 100644
--- a/src/detail/ca-request-state.hpp
+++ b/src/detail/ca-request-state.hpp
@@ -62,23 +62,23 @@
/**
* @brief The status of the challenge.
*/
- std::string m_challengeStatus;
+ std::string challengeStatus;
/**
* @brief The timestamp of the last update of the challenge state.
*/
- time::system_clock::TimePoint m_timestamp;
+ time::system_clock::TimePoint timestamp;
/**
* @brief Remaining tries of the challenge.
*/
- size_t m_remainingTries;
+ size_t remainingTries;
/**
* @brief Remaining time of the challenge.
*/
- time::seconds m_remainingTime;
+ time::seconds remainingTime;
/**
* @brief The secret for the challenge.
*/
- JsonSection m_secrets;
+ JsonSection secrets;
};
/**
@@ -107,40 +107,40 @@
/**
* @brief The CA that the request is under.
*/
- Name m_caPrefix;
+ Name caPrefix;
/**
* @brief The ID of the request.
*/
- RequestId m_requestId;
+ RequestId requestId;
/**
* @brief The type of the request.
*/
- RequestType m_requestType = RequestType::NOTINITIALIZED;
+ RequestType requestType = RequestType::NOTINITIALIZED;
/**
* @brief The status of the request.
*/
- Status m_status;
+ Status status;
/**
* @brief The self-signed certificate in the request.
*/
- security::Certificate m_cert;
+ security::Certificate cert;
/**
* @brief The encryption key for the requester.
*/
- std::array<uint8_t, 16> m_encryptionKey;
+ std::array<uint8_t, 16> encryptionKey;
/**
* @brief The AES block counter for the requester.
*/
- uint32_t m_aesBlockCounter = 0;
+ uint32_t aesBlockCounter = 0;
/**
* @brief The challenge type.
*/
- std::string m_challengeType;
+ std::string challengeType;
/**
* @brief The challenge state.
*/
- optional<ChallengeState> m_challengeState;
+ optional<ChallengeState> challengeState;
};
std::ostream&
diff --git a/src/detail/ca-sqlite.cpp b/src/detail/ca-sqlite.cpp
index 6ef80bc..db37397 100644
--- a/src/detail/ca-sqlite.cpp
+++ b/src/detail/ca-sqlite.cpp
@@ -172,24 +172,24 @@
cert_request, challenge_type, challenge_status, challenge_secrets,
challenge_tp, remaining_tries, remaining_time, encryption_key, aes_block_counter)
values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?))_SQLTEXT_");
- statement.bind(1, request.m_requestId.data(), request.m_requestId.size(), SQLITE_TRANSIENT);
- statement.bind(2, request.m_caPrefix.wireEncode(), SQLITE_TRANSIENT);
- statement.bind(3, static_cast<int>(request.m_status));
- statement.bind(4, static_cast<int>(request.m_requestType));
- statement.bind(5, request.m_cert.wireEncode(), SQLITE_TRANSIENT);
- statement.bind(12, request.m_encryptionKey.data(), request.m_encryptionKey.size(), SQLITE_TRANSIENT);
- statement.bind(13, request.m_aesBlockCounter);
- if (request.m_challengeState) {
- statement.bind(6, request.m_challengeType, SQLITE_TRANSIENT);
- statement.bind(7, request.m_challengeState->m_challengeStatus, SQLITE_TRANSIENT);
- statement.bind(8, convertJson2String(request.m_challengeState->m_secrets),
+ statement.bind(1, request.requestId.data(), request.requestId.size(), SQLITE_TRANSIENT);
+ statement.bind(2, request.caPrefix.wireEncode(), SQLITE_TRANSIENT);
+ statement.bind(3, static_cast<int>(request.status));
+ statement.bind(4, static_cast<int>(request.requestType));
+ statement.bind(5, request.cert.wireEncode(), SQLITE_TRANSIENT);
+ statement.bind(12, request.encryptionKey.data(), request.encryptionKey.size(), SQLITE_TRANSIENT);
+ statement.bind(13, request.aesBlockCounter);
+ if (request.challengeState) {
+ statement.bind(6, request.challengeType, SQLITE_TRANSIENT);
+ statement.bind(7, request.challengeState->challengeStatus, SQLITE_TRANSIENT);
+ statement.bind(8, convertJson2String(request.challengeState->secrets),
SQLITE_TRANSIENT);
- statement.bind(9, time::toIsoString(request.m_challengeState->m_timestamp), SQLITE_TRANSIENT);
- statement.bind(10, request.m_challengeState->m_remainingTries);
- statement.bind(11, request.m_challengeState->m_remainingTime.count());
+ statement.bind(9, time::toIsoString(request.challengeState->timestamp), SQLITE_TRANSIENT);
+ statement.bind(10, request.challengeState->remainingTries);
+ statement.bind(11, request.challengeState->remainingTime.count());
}
if (statement.step() != SQLITE_DONE) {
- NDN_THROW(std::runtime_error("Request " + toHex(request.m_requestId.data(), request.m_requestId.size()) + " cannot be added to database"));
+ NDN_THROW(std::runtime_error("Request " + toHex(request.requestId.data(), request.requestId.size()) + " cannot be added to database"));
}
}
@@ -201,14 +201,14 @@
SET status = ?, challenge_type = ?, challenge_status = ?, challenge_secrets = ?,
challenge_tp = ?, remaining_tries = ?, remaining_time = ?, aes_block_counter = ?
WHERE request_id = ?)_SQLTEXT_");
- statement.bind(1, static_cast<int>(request.m_status));
- statement.bind(2, request.m_challengeType, SQLITE_TRANSIENT);
- if (request.m_challengeState) {
- statement.bind(3, request.m_challengeState->m_challengeStatus, SQLITE_TRANSIENT);
- statement.bind(4, convertJson2String(request.m_challengeState->m_secrets), SQLITE_TRANSIENT);
- statement.bind(5, time::toIsoString(request.m_challengeState->m_timestamp), SQLITE_TRANSIENT);
- statement.bind(6, request.m_challengeState->m_remainingTries);
- statement.bind(7, request.m_challengeState->m_remainingTime.count());
+ statement.bind(1, static_cast<int>(request.status));
+ statement.bind(2, request.challengeType, SQLITE_TRANSIENT);
+ if (request.challengeState) {
+ statement.bind(3, request.challengeState->challengeStatus, SQLITE_TRANSIENT);
+ statement.bind(4, convertJson2String(request.challengeState->secrets), SQLITE_TRANSIENT);
+ statement.bind(5, time::toIsoString(request.challengeState->timestamp), SQLITE_TRANSIENT);
+ statement.bind(6, request.challengeState->remainingTries);
+ statement.bind(7, request.challengeState->remainingTime.count());
}
else {
statement.bind(3, "", SQLITE_TRANSIENT);
@@ -217,8 +217,8 @@
statement.bind(6, 0);
statement.bind(7, 0);
}
- statement.bind(8, request.m_aesBlockCounter);
- statement.bind(9, request.m_requestId.data(), request.m_requestId.size(), SQLITE_TRANSIENT);
+ statement.bind(8, request.aesBlockCounter);
+ statement.bind(9, request.requestId.data(), request.requestId.size(), SQLITE_TRANSIENT);
if (statement.step() != SQLITE_DONE) {
addRequest(request);
diff --git a/src/detail/challenge-encoder.cpp b/src/detail/challenge-encoder.cpp
index 41a0f8f..12eb7cf 100644
--- a/src/detail/challenge-encoder.cpp
+++ b/src/detail/challenge-encoder.cpp
@@ -27,21 +27,21 @@
challengetlv::encodeDataContent(ca::RequestState& request, const Name& issuedCertName)
{
Block response(tlv::EncryptedPayload);
- response.push_back(makeNonNegativeIntegerBlock(tlv::Status, static_cast<uint64_t>(request.m_status)));
- if (request.m_challengeState) {
- response.push_back(makeStringBlock(tlv::ChallengeStatus, request.m_challengeState->m_challengeStatus));
+ response.push_back(makeNonNegativeIntegerBlock(tlv::Status, static_cast<uint64_t>(request.status)));
+ if (request.challengeState) {
+ response.push_back(makeStringBlock(tlv::ChallengeStatus, request.challengeState->challengeStatus));
response.push_back(
- makeNonNegativeIntegerBlock(tlv::RemainingTries, request.m_challengeState->m_remainingTries));
+ makeNonNegativeIntegerBlock(tlv::RemainingTries, request.challengeState->remainingTries));
response.push_back(
- makeNonNegativeIntegerBlock(tlv::RemainingTime, request.m_challengeState->m_remainingTime.count()));
+ makeNonNegativeIntegerBlock(tlv::RemainingTime, request.challengeState->remainingTime.count()));
}
if (!issuedCertName.empty()) {
response.push_back(makeNestedBlock(tlv::IssuedCertName, issuedCertName));
}
response.encode();
- return encodeBlockWithAesGcm128(ndn::tlv::Content, request.m_encryptionKey.data(),
+ return encodeBlockWithAesGcm128(ndn::tlv::Content, request.encryptionKey.data(),
response.value(), response.value_size(),
- request.m_requestId.data(), request.m_requestId.size(), request.m_aesBlockCounter);
+ request.requestId.data(), request.requestId.size(), request.aesBlockCounter);
}
void
diff --git a/src/detail/probe-encoder.cpp b/src/detail/probe-encoder.cpp
index e8f5218..d671aef 100644
--- a/src/detail/probe-encoder.cpp
+++ b/src/detail/probe-encoder.cpp
@@ -24,7 +24,7 @@
namespace ndncert {
Block
-probetlv::encodeApplicationParameters(std::multimap<std::string, std::string>&& parameters)
+probetlv::encodeApplicationParameters(const std::multimap<std::string, std::string>& parameters)
{
Block content(ndn::tlv::ApplicationParameters);
for (const auto& items : parameters) {
diff --git a/src/detail/probe-encoder.hpp b/src/detail/probe-encoder.hpp
index 2b63cc1..bde8a87 100644
--- a/src/detail/probe-encoder.hpp
+++ b/src/detail/probe-encoder.hpp
@@ -29,7 +29,7 @@
// For Client use
Block
-encodeApplicationParameters(std::multimap<std::string, std::string>&& parameters);
+encodeApplicationParameters(const std::multimap<std::string, std::string>& parameters);
void
decodeDataContent(const Block& block, std::vector<std::pair<Name, int>>& availableNames,