clean header file include
Change-Id: I5df52db13f964a92bba7cc8659ec6bcc222f5cbb
diff --git a/src/ca-config.hpp b/src/ca-config.hpp
index fbdfb24..bba5af4 100644
--- a/src/ca-config.hpp
+++ b/src/ca-config.hpp
@@ -21,9 +21,7 @@
#ifndef NDNCERT_CA_CONFIG_HPP
#define NDNCERT_CA_CONFIG_HPP
-#include <ndn-cxx/security/v2/certificate.hpp>
-
-#include "certificate-request.hpp"
+#include "request-state.hpp"
#include "client-config.hpp"
namespace ndn {
@@ -46,9 +44,9 @@
* fired whenever a request instance is created, challenge status is updated, and when certificate
* is issued.
*
- * @p CertificateRequest, input, the state of the certificate request whose status is updated.
+ * @p RequestState, input, the state of the certificate request whose status is updated.
*/
-using StatusUpdateCallback = function<void(const CertificateRequest&)>;
+using StatusUpdateCallback = function<void(const RequestState&)>;
/**
* @brief CA's configuration on NDNCERT.
diff --git a/src/ca-detail/ca-memory.cpp b/src/ca-detail/ca-memory.cpp
index 437afa4..a81f4bf 100644
--- a/src/ca-detail/ca-memory.cpp
+++ b/src/ca-detail/ca-memory.cpp
@@ -30,7 +30,7 @@
NDNCERT_REGISTER_CA_STORAGE(CaMemory);
-CertificateRequest
+RequestState
CaMemory::getRequest(const std::string& requestId)
{
auto search = m_requests.find(requestId);
@@ -41,7 +41,7 @@
}
void
-CaMemory::addRequest(const CertificateRequest& request)
+CaMemory::addRequest(const RequestState& request)
{
for (auto& entry : m_requests) {
const auto& existingRequest = entry.second;
@@ -68,7 +68,7 @@
}
void
-CaMemory::updateRequest(const CertificateRequest& request)
+CaMemory::updateRequest(const RequestState& request)
{
m_requests[request.m_requestId] = request;
}
@@ -82,20 +82,20 @@
}
}
-std::list<CertificateRequest>
+std::list<RequestState>
CaMemory::listAllRequests()
{
- std::list<CertificateRequest> result;
+ std::list<RequestState> result;
for (const auto& entry : m_requests) {
result.push_back(entry.second);
}
return result;
}
-std::list<CertificateRequest>
+std::list<RequestState>
CaMemory::listAllRequests(const Name& caName)
{
- std::list<CertificateRequest> result;
+ std::list<RequestState> result;
for (const auto& entry : m_requests) {
if (entry.second.m_caPrefix == caName) {
result.push_back(entry.second);
diff --git a/src/ca-detail/ca-memory.hpp b/src/ca-detail/ca-memory.hpp
index 859c726..19e7d4f 100644
--- a/src/ca-detail/ca-memory.hpp
+++ b/src/ca-detail/ca-memory.hpp
@@ -33,22 +33,22 @@
public:
// certificate request related
- CertificateRequest
+ RequestState
getRequest(const std::string& requestId) override;
void
- addRequest(const CertificateRequest& request) override;
+ addRequest(const RequestState& request) override;
void
- updateRequest(const CertificateRequest& request) override;
+ updateRequest(const RequestState& request) override;
void
deleteRequest(const std::string& requestId) override;
- std::list<CertificateRequest>
+ std::list<RequestState>
listAllRequests() override;
- std::list<CertificateRequest>
+ std::list<RequestState>
listAllRequests(const Name& caName) override;
// certificate related
@@ -71,7 +71,7 @@
listAllIssuedCertificates(const Name& caName) override;
private:
- std::map<std::string, CertificateRequest> m_requests;
+ std::map<std::string, RequestState> m_requests;
std::map<std::string, security::v2::Certificate> m_issuedCerts;
};
diff --git a/src/ca-detail/ca-sqlite.cpp b/src/ca-detail/ca-sqlite.cpp
index a73f46c..905bfa5 100644
--- a/src/ca-detail/ca-sqlite.cpp
+++ b/src/ca-detail/ca-sqlite.cpp
@@ -113,7 +113,7 @@
sqlite3_close(m_database);
}
-CertificateRequest
+RequestState
CaSqlite::getRequest(const std::string& requestId)
{
Sqlite3Statement statement(m_database,
@@ -136,13 +136,13 @@
auto remainingTime = statement.getInt(9);
auto requestType = static_cast<RequestType>(statement.getInt(10));
if (challengeType != "") {
- return CertificateRequest(caName, requestId, requestType, status, cert,
+ return RequestState(caName, requestId, requestType, status, cert,
challengeType, challengeStatus, time::fromIsoString(challengeTp),
remainingTries, time::seconds(remainingTime),
convertString2Json(challengeSecrets));
}
else {
- return CertificateRequest(caName, requestId, requestType, status, cert);
+ return RequestState(caName, requestId, requestType, status, cert);
}
}
else {
@@ -151,7 +151,7 @@
}
void
-CaSqlite::addRequest(const CertificateRequest& request)
+CaSqlite::addRequest(const RequestState& request)
{
// check whether request is there already
auto keyNameTlv = request.m_cert.getKeyName().wireEncode();
@@ -197,7 +197,7 @@
}
void
-CaSqlite::updateRequest(const CertificateRequest& request)
+CaSqlite::updateRequest(const RequestState& request)
{
Sqlite3Statement statement(m_database,
R"_SQLTEXT_(UPDATE CertRequests
@@ -228,10 +228,10 @@
}
}
-std::list<CertificateRequest>
+std::list<RequestState>
CaSqlite::listAllRequests()
{
- std::list<CertificateRequest> result;
+ std::list<RequestState> result;
Sqlite3Statement statement(m_database, R"_SQLTEXT_(SELECT id, request_id, ca_name, status,
challenge_status, cert_key_name, cert_request, challenge_type, challenge_secrets,
challenge_tp, remaining_tries, remaining_time, request_type
@@ -249,22 +249,22 @@
auto remainingTime = statement.getInt(11);
auto requestType = static_cast<RequestType>(statement.getInt(12));
if (challengeType != "") {
- result.push_back(CertificateRequest(caName, requestId, requestType, status, cert,
+ result.push_back(RequestState(caName, requestId, requestType, status, cert,
challengeType, challengeStatus, time::fromIsoString(challengeTp),
remainingTries, time::seconds(remainingTime),
convertString2Json(challengeSecrets)));
}
else {
- result.push_back(CertificateRequest(caName, requestId, requestType, status, cert));
+ result.push_back(RequestState(caName, requestId, requestType, status, cert));
}
}
return result;
}
-std::list<CertificateRequest>
+std::list<RequestState>
CaSqlite::listAllRequests(const Name& caName)
{
- std::list<CertificateRequest> result;
+ std::list<RequestState> result;
Sqlite3Statement statement(m_database,
R"_SQLTEXT_(SELECT id, request_id, ca_name, status,
challenge_status, cert_key_name, cert_request, challenge_type, challenge_secrets,
@@ -285,13 +285,13 @@
auto remainingTime = statement.getInt(11);
auto requestType = static_cast<RequestType>(statement.getInt(12));
if (challengeType != "") {
- result.push_back(CertificateRequest(caName, requestId, requestType, status, cert,
+ result.push_back(RequestState(caName, requestId, requestType, status, cert,
challengeType, challengeStatus, time::fromIsoString(challengeTp),
remainingTries, time::seconds(remainingTime),
convertString2Json(challengeSecrets)));
}
else {
- result.push_back(CertificateRequest(caName, requestId, requestType, status, cert));
+ result.push_back(RequestState(caName, requestId, requestType, status, cert));
}
}
return result;
diff --git a/src/ca-detail/ca-sqlite.hpp b/src/ca-detail/ca-sqlite.hpp
index 200361d..2d22a21 100644
--- a/src/ca-detail/ca-sqlite.hpp
+++ b/src/ca-detail/ca-sqlite.hpp
@@ -22,7 +22,7 @@
#define NDNCERT_CA_DETAIL_CA_SQLITE_HPP
#include "../ca-module.hpp"
-#include "../certificate-request.hpp"
+#include "../request-state.hpp"
struct sqlite3;
@@ -41,22 +41,22 @@
public:
// certificate request related
- CertificateRequest
+ RequestState
getRequest(const std::string& requestId) override;
void
- addRequest(const CertificateRequest& request) override;
+ addRequest(const RequestState& request) override;
void
- updateRequest(const CertificateRequest& request) override;
+ updateRequest(const RequestState& request) override;
void
deleteRequest(const std::string& requestId) override;
- std::list<CertificateRequest>
+ std::list<RequestState>
listAllRequests() override;
- std::list<CertificateRequest>
+ std::list<RequestState>
listAllRequests(const Name& caName) override;
// certificate related
diff --git a/src/ca-module.cpp b/src/ca-module.cpp
index bf98856..0c5373f 100644
--- a/src/ca-module.cpp
+++ b/src/ca-module.cpp
@@ -334,7 +334,7 @@
// create new request instance
std::string requestId = std::to_string(random::generateWord64());
- CertificateRequest certRequest(m_config.m_caPrefix, requestId, requestType, Status::BEFORE_CHALLENGE, *clientCert);
+ RequestState certRequest(m_config.m_caPrefix, requestId, requestType, Status::BEFORE_CHALLENGE, *clientCert);
m_storage->addRequest(certRequest);
Data result;
result.setName(request.getName());
@@ -362,7 +362,7 @@
CaModule::onChallenge(const Interest& request)
{
// get certificate request state
- CertificateRequest certRequest = getCertificateRequest(request);
+ RequestState certRequest = getCertificateRequest(request);
if (certRequest.m_requestId == "") {
_LOG_ERROR("No certificate request state can be found.");
m_face.put(generateErrorDataPacket(request.getName(), ErrorCode::INVALID_PARAMETER,
@@ -461,7 +461,7 @@
}
security::v2::Certificate
-CaModule::issueCertificate(const CertificateRequest& certRequest)
+CaModule::issueCertificate(const RequestState& certRequest)
{
auto expectedPeriod =
certRequest.m_cert.getValidityPeriod().getPeriod();
@@ -483,11 +483,11 @@
return newCert;
}
-CertificateRequest
+RequestState
CaModule::getCertificateRequest(const Interest& request)
{
std::string requestId;
- CertificateRequest certRequest;
+ RequestState certRequest;
try {
requestId = readString(request.getName().at(m_config.m_caPrefix.size() + 2));
}
diff --git a/src/ca-module.hpp b/src/ca-module.hpp
index f288f65..3bb3a1e 100644
--- a/src/ca-module.hpp
+++ b/src/ca-module.hpp
@@ -92,11 +92,11 @@
void
onRegisterFailed(const std::string& reason);
- CertificateRequest
+ RequestState
getCertificateRequest(const Interest& request);
security::v2::Certificate
- issueCertificate(const CertificateRequest& certRequest);
+ issueCertificate(const RequestState& certRequest);
void
registerPrefix();
diff --git a/src/ca-storage.hpp b/src/ca-storage.hpp
index 2cf7b7e..3abba7f 100644
--- a/src/ca-storage.hpp
+++ b/src/ca-storage.hpp
@@ -21,7 +21,7 @@
#ifndef NDNCERT_CA_STORAGE_HPP
#define NDNCERT_CA_STORAGE_HPP
-#include "certificate-request.hpp"
+#include "request-state.hpp"
namespace ndn {
namespace ndncert {
@@ -42,22 +42,22 @@
~CaStorage();
public: // certificate request related
- virtual CertificateRequest
+ virtual RequestState
getRequest(const std::string& requestId) = 0;
virtual void
- addRequest(const CertificateRequest& request) = 0;
+ addRequest(const RequestState& request) = 0;
virtual void
- updateRequest(const CertificateRequest& request) = 0;
+ updateRequest(const RequestState& request) = 0;
virtual void
deleteRequest(const std::string& requestId) = 0;
- virtual std::list<CertificateRequest>
+ virtual std::list<RequestState>
listAllRequests() = 0;
- virtual std::list<CertificateRequest>
+ virtual std::list<RequestState>
listAllRequests(const Name& caName) = 0;
public: // certificate related
diff --git a/src/challenge-module.cpp b/src/challenge-module.cpp
index 38cd284..7e97830 100644
--- a/src/challenge-module.cpp
+++ b/src/challenge-module.cpp
@@ -71,7 +71,7 @@
}
std::tuple<ErrorCode, std::string>
-ChallengeModule::returnWithError(CertificateRequest& request, ErrorCode errorCode, std::string&& errorInfo)
+ChallengeModule::returnWithError(RequestState& request, ErrorCode errorCode, std::string&& errorInfo)
{
request.m_status = Status::FAILURE;
request.m_challengeType = "";
@@ -80,7 +80,7 @@
}
std::tuple<ErrorCode, std::string>
-ChallengeModule::returnWithNewChallengeStatus(CertificateRequest& request, const std::string& challengeStatus,
+ChallengeModule::returnWithNewChallengeStatus(RequestState& request, const std::string& challengeStatus,
JsonSection&& challengeSecret, size_t remainingTries, time::seconds remainingTime)
{
request.m_status = Status::CHALLENGE;
@@ -90,7 +90,7 @@
}
std::tuple<ErrorCode, std::string>
-ChallengeModule::returnWithSuccess(CertificateRequest& request)
+ChallengeModule::returnWithSuccess(RequestState& request)
{
request.m_status = Status::PENDING;
request.m_challengeType = CHALLENGE_TYPE;
diff --git a/src/challenge-module.hpp b/src/challenge-module.hpp
index be17e10..bef26b5 100644
--- a/src/challenge-module.hpp
+++ b/src/challenge-module.hpp
@@ -21,11 +21,9 @@
#ifndef NDNCERT_CHALLENGE_MODULE_HPP
#define NDNCERT_CHALLENGE_MODULE_HPP
+#include "request-state.hpp"
#include <tuple>
-#include "certificate-request.hpp"
-#include "ndncert-common.hpp"
-
namespace ndn {
namespace ndncert {
@@ -52,7 +50,7 @@
// For CA
virtual std::tuple<ErrorCode, std::string>
- handleChallengeRequest(const Block& params, CertificateRequest& request) = 0;
+ handleChallengeRequest(const Block& params, RequestState& request) = 0;
// For Client
virtual std::vector<std::tuple<std::string, std::string>>
@@ -69,14 +67,14 @@
protected:
// used by challenge modules
std::tuple<ErrorCode, std::string>
- returnWithError(CertificateRequest& request, ErrorCode errorCode, std::string&& errorInfo);
+ returnWithError(RequestState& request, ErrorCode errorCode, std::string&& errorInfo);
std::tuple<ErrorCode, std::string>
- returnWithNewChallengeStatus(CertificateRequest& request, const std::string& challengeStatus,
+ returnWithNewChallengeStatus(RequestState& request, const std::string& challengeStatus,
JsonSection&& challengeSecret, size_t remainingTries, time::seconds remainingTime);
std::tuple<ErrorCode, std::string>
- returnWithSuccess(CertificateRequest& request);
+ returnWithSuccess(RequestState& request);
public:
const std::string CHALLENGE_TYPE;
diff --git a/src/challenge-module/challenge-credential.cpp b/src/challenge-module/challenge-credential.cpp
index a41aa56..7102434 100644
--- a/src/challenge-module/challenge-credential.cpp
+++ b/src/challenge-module/challenge-credential.cpp
@@ -74,7 +74,7 @@
// For CA
std::tuple<ErrorCode, std::string>
-ChallengeCredential::handleChallengeRequest(const Block& params, CertificateRequest& request)
+ChallengeCredential::handleChallengeRequest(const Block& params, RequestState& request)
{
params.parse();
if (m_trustAnchors.empty()) {
diff --git a/src/challenge-module/challenge-credential.hpp b/src/challenge-module/challenge-credential.hpp
index 93838a8..e356289 100644
--- a/src/challenge-module/challenge-credential.hpp
+++ b/src/challenge-module/challenge-credential.hpp
@@ -53,7 +53,7 @@
// For CA
std::tuple<ErrorCode, std::string>
- handleChallengeRequest(const Block& params, CertificateRequest& request) override;
+ handleChallengeRequest(const Block& params, RequestState& request) override;
// For Client
std::vector<std::tuple<std::string, std::string>>
diff --git a/src/challenge-module/challenge-email.cpp b/src/challenge-module/challenge-email.cpp
index 2e9e133..327fb79 100644
--- a/src/challenge-module/challenge-email.cpp
+++ b/src/challenge-module/challenge-email.cpp
@@ -45,7 +45,7 @@
// For CA
std::tuple<ErrorCode, std::string>
-ChallengeEmail::handleChallengeRequest(const Block& params, CertificateRequest& request)
+ChallengeEmail::handleChallengeRequest(const Block& params, RequestState& request)
{
params.parse();
auto currentTime = time::system_clock::now();
@@ -159,7 +159,7 @@
void
ChallengeEmail::sendEmail(const std::string& emailAddress, const std::string& secret,
- const CertificateRequest& request) const
+ const RequestState& request) const
{
std::string command = m_sendEmailScript;
command += " \"" + emailAddress + "\" \"" + secret + "\" \"" + request.m_caPrefix.toUri() + "\" \"" + request.m_cert.getName().toUri() + "\"";
diff --git a/src/challenge-module/challenge-email.hpp b/src/challenge-module/challenge-email.hpp
index 42a329d..f853e95 100644
--- a/src/challenge-module/challenge-email.hpp
+++ b/src/challenge-module/challenge-email.hpp
@@ -22,8 +22,6 @@
#define NDNCERT_CHALLENGE_EMAIL_HPP
#include "../challenge-module.hpp"
-#include <ndn-cxx/util/time.hpp>
-#include <ndn-cxx/encoding/block.hpp>
namespace ndn {
namespace ndncert {
@@ -59,7 +57,7 @@
// For CA
std::tuple<ErrorCode, std::string>
- handleChallengeRequest(const Block& params, CertificateRequest& request) override;
+ handleChallengeRequest(const Block& params, RequestState& request) override;
// For Client
std::vector<std::tuple<std::string, std::string>>
@@ -75,7 +73,7 @@
void
sendEmail(const std::string& emailAddress, const std::string& secret,
- const CertificateRequest& request) const;
+ const RequestState& request) const;
PUBLIC_WITH_TESTS_ELSE_PRIVATE:
// challenge status
diff --git a/src/challenge-module/challenge-pin.cpp b/src/challenge-module/challenge-pin.cpp
index caad97d..4853eed 100644
--- a/src/challenge-module/challenge-pin.cpp
+++ b/src/challenge-module/challenge-pin.cpp
@@ -41,7 +41,7 @@
// For CA
std::tuple<ErrorCode, std::string>
-ChallengePin::handleChallengeRequest(const Block& params, CertificateRequest& request)
+ChallengePin::handleChallengeRequest(const Block& params, RequestState& request)
{
params.parse();
auto currentTime = time::system_clock::now();
diff --git a/src/challenge-module/challenge-pin.hpp b/src/challenge-module/challenge-pin.hpp
index 9e7d8b0..0b73cb2 100644
--- a/src/challenge-module/challenge-pin.hpp
+++ b/src/challenge-module/challenge-pin.hpp
@@ -22,7 +22,6 @@
#define NDNCERT_CHALLENGE_PIN_HPP
#include "../challenge-module.hpp"
-#include <ndn-cxx/util/time.hpp>
namespace ndn {
namespace ndncert {
@@ -53,7 +52,7 @@
// For CA
std::tuple<ErrorCode, std::string>
- handleChallengeRequest(const Block& params, CertificateRequest& request) override;
+ handleChallengeRequest(const Block& params, RequestState& request) override;
// For Client
std::vector<std::tuple<std::string, std::string>>
diff --git a/src/client-config.hpp b/src/client-config.hpp
index 2d74cf6..0665808 100644
--- a/src/client-config.hpp
+++ b/src/client-config.hpp
@@ -21,7 +21,7 @@
#ifndef NDNCERT_CLIENT_CONFIG_HPP
#define NDNCERT_CLIENT_CONFIG_HPP
-#include "certificate-request.hpp"
+#include "request-state.hpp"
#include <ndn-cxx/security/v2/certificate.hpp>
namespace ndn {
diff --git a/src/client-module.hpp b/src/client-module.hpp
index 47a5f63..c439d3c 100644
--- a/src/client-module.hpp
+++ b/src/client-module.hpp
@@ -22,7 +22,7 @@
#define NDNCERT_CLIENT_MODULE_HPP
#include "client-config.hpp"
-#include "certificate-request.hpp"
+#include "request-state.hpp"
#include "crypto-support/crypto-helper.hpp"
namespace ndn {
diff --git a/src/crypto-support/crypto-helper.hpp b/src/crypto-support/crypto-helper.hpp
index 53f57f1..ad8aa22 100644
--- a/src/crypto-support/crypto-helper.hpp
+++ b/src/crypto-support/crypto-helper.hpp
@@ -21,11 +21,10 @@
#ifndef NDNCERT_CRYPTO_SUPPORT_CRYPTO_HELPER_HPP
#define NDNCERT_CRYPTO_SUPPORT_CRYPTO_HELPER_HPP
+#include "request-state.hpp"
#include <openssl/ec.h>
#include <openssl/evp.h>
-#include "certificate-request.hpp"
-
namespace ndn {
namespace ndncert {
diff --git a/src/protocol-detail/challenge.cpp b/src/protocol-detail/challenge.cpp
index b8823e0..61a3519 100644
--- a/src/protocol-detail/challenge.cpp
+++ b/src/protocol-detail/challenge.cpp
@@ -20,13 +20,13 @@
#include "challenge.hpp"
#include "../ndncert-common.hpp"
-#include "../certificate-request.hpp"
+#include "../request-state.hpp"
namespace ndn {
namespace ndncert {
Block
-CHALLENGE::encodeDataPayload(const CertificateRequest& request)
+CHALLENGE::encodeDataPayload(const RequestState& request)
{
Block response = makeEmptyBlock(tlv_encrypted_payload);
response.push_back(makeNonNegativeIntegerBlock(tlv_status, static_cast<size_t>(request.m_status)));
diff --git a/src/protocol-detail/challenge.hpp b/src/protocol-detail/challenge.hpp
index 1ff74fd..aafcd42 100644
--- a/src/protocol-detail/challenge.hpp
+++ b/src/protocol-detail/challenge.hpp
@@ -21,8 +21,7 @@
#ifndef NDNCERT_PROTOCOL_DETAIL_CHALLENGE_HPP
#define NDNCERT_PROTOCOL_DETAIL_CHALLENGE_HPP
-#include "../certificate-request.hpp"
-#include <ndn-cxx/encoding/block.hpp>
+#include "../request-state.hpp"
namespace ndn {
namespace ndncert {
@@ -30,7 +29,7 @@
class CHALLENGE {
public:
static Block
- encodeDataPayload(const CertificateRequest& request);
+ encodeDataPayload(const RequestState& request);
};
} // namespace ndncert
diff --git a/src/protocol-detail/new.cpp b/src/protocol-detail/new.cpp
index 243865a..cd7b39c 100644
--- a/src/protocol-detail/new.cpp
+++ b/src/protocol-detail/new.cpp
@@ -53,7 +53,7 @@
Block
NEW::encodeDataContent(const std::string& ecdhKey, const std::string& salt,
- const CertificateRequest& request,
+ const RequestState& request,
const std::list<std::string>& challenges)
{
Block response = makeEmptyBlock(tlv::Content);
diff --git a/src/protocol-detail/new.hpp b/src/protocol-detail/new.hpp
index 63bec73..353ebc2 100644
--- a/src/protocol-detail/new.hpp
+++ b/src/protocol-detail/new.hpp
@@ -21,10 +21,7 @@
#ifndef NDNCERT_PROTOCOL_DETAIL_NEW_HPP
#define NDNCERT_PROTOCOL_DETAIL_NEW_HPP
-#include <ndn-cxx/security/v2/certificate.hpp>
-
-#include "../certificate-request.hpp"
-#include "ndn-cxx/encoding/block.hpp"
+#include "../request-state.hpp"
namespace ndn {
namespace ndncert {
@@ -44,7 +41,7 @@
*/
static Block
encodeDataContent(const std::string& ecdhKey, const std::string& salt,
- const CertificateRequest& request,
+ const RequestState& request,
const std::list<std::string>& challenges);
};
diff --git a/src/protocol-detail/revoke.cpp b/src/protocol-detail/revoke.cpp
index f8e3142..0123b3f 100644
--- a/src/protocol-detail/revoke.cpp
+++ b/src/protocol-detail/revoke.cpp
@@ -53,7 +53,7 @@
Block
REVOKE::encodeDataContent(const std::string& ecdhKey, const std::string& salt,
- const CertificateRequest& request,
+ const RequestState& request,
const std::list<std::string>& challenges)
{
Block response = makeEmptyBlock(tlv::Content);
diff --git a/src/protocol-detail/revoke.hpp b/src/protocol-detail/revoke.hpp
index 665ed11..9f02c43 100644
--- a/src/protocol-detail/revoke.hpp
+++ b/src/protocol-detail/revoke.hpp
@@ -21,9 +21,7 @@
#ifndef NDNCERT_PROTOCOL_DETAIL_REVOKE_HPP
#define NDNCERT_PROTOCOL_DETAIL_REVOKE_HPP
-#include "../certificate-request.hpp"
-#include "ndn-cxx/encoding/block.hpp"
-#include <ndn-cxx/security/v2/certificate.hpp>
+#include "../request-state.hpp"
namespace ndn {
namespace ndncert {
@@ -35,7 +33,7 @@
static Block
encodeDataContent(const std::string& ecdhKey, const std::string& salt,
- const CertificateRequest& request,
+ const RequestState& request,
const std::list<std::string>& challenges);
};
diff --git a/src/certificate-request.cpp b/src/request-state.cpp
similarity index 89%
rename from src/certificate-request.cpp
rename to src/request-state.cpp
index 36ee00b..1cc696c 100644
--- a/src/certificate-request.cpp
+++ b/src/request-state.cpp
@@ -18,7 +18,7 @@
* See AUTHORS.md for complete list of ndncert authors and contributors.
*/
-#include "certificate-request.hpp"
+#include "request-state.hpp"
#include <ndn-cxx/util/indented-stream.hpp>
namespace ndn {
@@ -36,13 +36,13 @@
{
}
-CertificateRequest::CertificateRequest()
+RequestState::RequestState()
: m_requestType(RequestType::NOTINITIALIZED)
, m_status(Status::NOT_STARTED)
{
}
-CertificateRequest::CertificateRequest(const Name& caName, const std::string& requestId, RequestType requestType, Status status,
+RequestState::RequestState(const Name& caName, const std::string& requestId, RequestType requestType, Status status,
const security::v2::Certificate& cert)
: m_caPrefix(caName)
, m_requestId(requestId)
@@ -52,7 +52,7 @@
{
}
-CertificateRequest::CertificateRequest(const Name& caName, const std::string& requestId, RequestType requestType, Status status,
+RequestState::RequestState(const Name& caName, const std::string& requestId, RequestType requestType, Status status,
const security::v2::Certificate& cert, const std::string& challengeType,
const std::string& challengeStatus, const system_clock::TimePoint& challengeTp,
size_t remainingTries, time::seconds remainingTime, JsonSection&& challengeSecrets)
@@ -67,7 +67,7 @@
}
std::ostream&
-operator<<(std::ostream& os, const CertificateRequest& request)
+operator<<(std::ostream& os, const RequestState& request)
{
os << "Request's CA name:\n";
os << " " << request.m_caPrefix << "\n";
diff --git a/src/certificate-request.hpp b/src/request-state.hpp
similarity index 82%
rename from src/certificate-request.hpp
rename to src/request-state.hpp
index ee52218..b5dc430 100644
--- a/src/certificate-request.hpp
+++ b/src/request-state.hpp
@@ -18,8 +18,8 @@
* See AUTHORS.md for complete list of ndncert authors and contributors.
*/
-#ifndef NDNCERT_CERTIFICATE_REQUEST_HPP
-#define NDNCERT_CERTIFICATE_REQUEST_HPP
+#ifndef NDNCERT_REQUEST_STATE_HPP
+#define NDNCERT_REQUEST_STATE_HPP
#include "ndncert-common.hpp"
@@ -44,12 +44,12 @@
* m_challengeDefinedField to finish verification.
*
*/
-class CertificateRequest {
+class RequestState {
public:
- CertificateRequest();
- CertificateRequest(const Name& caName, const std::string& requestId, RequestType requestType, Status status,
+ RequestState();
+ RequestState(const Name& caName, const std::string& requestId, RequestType requestType, Status status,
const security::v2::Certificate& cert);
- CertificateRequest(const Name& caName, const std::string& requestId, RequestType requestType, Status status,
+ RequestState(const Name& caName, const std::string& requestId, RequestType requestType, Status status,
const security::v2::Certificate& cert, const std::string& challengeType,
const std::string& challengeStatus, const system_clock::TimePoint& challengeTp,
size_t remainingTries, time::seconds remainingTime, JsonSection&& challengeSecrets);
@@ -66,9 +66,9 @@
};
std::ostream&
-operator<<(std::ostream& os, const CertificateRequest& request);
+operator<<(std::ostream& os, const RequestState& request);
} // namespace ndncert
} // namespace ndn
-#endif // NDNCERT_CERTIFICATE_REQUEST_HPP
+#endif // NDNCERT_REQUEST_STATE_HPP
diff --git a/tests/unit-tests/ca-memory.t.cpp b/tests/unit-tests/ca-memory.t.cpp
index 1f50b99..7db815a 100644
--- a/tests/unit-tests/ca-memory.t.cpp
+++ b/tests/unit-tests/ca-memory.t.cpp
@@ -82,7 +82,7 @@
auto cert1 = key1.getDefaultCertificate();
// add operation
- CertificateRequest request1(Name("/ndn/site1"), "123", RequestType::NEW, Status::BEFORE_CHALLENGE, cert1);
+ RequestState request1(Name("/ndn/site1"), "123", RequestType::NEW, Status::BEFORE_CHALLENGE, cert1);
BOOST_CHECK_NO_THROW(storage.addRequest(request1));
// get operation
@@ -95,7 +95,7 @@
json.put("code", "1234");
// update operation
- CertificateRequest request2(Name("/ndn/site1"), "123", RequestType::NEW, Status::CHALLENGE, cert1,
+ RequestState request2(Name("/ndn/site1"), "123", RequestType::NEW, Status::CHALLENGE, cert1,
"email", "test", time::system_clock::now(), 3, time::seconds(3600), std::move(json));
storage.updateRequest(request2);
result = storage.getRequest("123");
@@ -106,7 +106,7 @@
auto identity2 = addIdentity(Name("/ndn/site2"));
auto key2 = identity2.getDefaultKey();
auto cert2 = key2.getDefaultCertificate();
- CertificateRequest request3(Name("/ndn/site2"), "456", RequestType::NEW, Status::BEFORE_CHALLENGE, cert2);
+ RequestState request3(Name("/ndn/site2"), "456", RequestType::NEW, Status::BEFORE_CHALLENGE, cert2);
storage.addRequest(request3);
// list operation
diff --git a/tests/unit-tests/ca-module.t.cpp b/tests/unit-tests/ca-module.t.cpp
index 4e3a94a..2bee0c4 100644
--- a/tests/unit-tests/ca-module.t.cpp
+++ b/tests/unit-tests/ca-module.t.cpp
@@ -427,7 +427,7 @@
signatureInfo.setValidityPeriod(security::ValidityPeriod(time::system_clock::now(),
time::system_clock::now() + time::hours(10)));
m_keyChain.sign(clientCert, signingByKey(clientKey.getName()).setSignatureInfo(signatureInfo));
- CertificateRequest certRequest(Name("/ndn"), "122", RequestType::NEW, Status::SUCCESS, clientCert);
+ RequestState certRequest(Name("/ndn"), "122", RequestType::NEW, Status::SUCCESS, clientCert);
auto issuedCert = ca.issueCertificate(certRequest);
ClientModule client(m_keyChain);
diff --git a/tests/unit-tests/ca-sqlite.t.cpp b/tests/unit-tests/ca-sqlite.t.cpp
index 779532d..754009a 100644
--- a/tests/unit-tests/ca-sqlite.t.cpp
+++ b/tests/unit-tests/ca-sqlite.t.cpp
@@ -81,7 +81,7 @@
auto cert1 = key1.getDefaultCertificate();
// add operation
- CertificateRequest request1(Name("/ndn/site1"), "123", RequestType::NEW, Status::BEFORE_CHALLENGE, cert1);
+ RequestState request1(Name("/ndn/site1"), "123", RequestType::NEW, Status::BEFORE_CHALLENGE, cert1);
BOOST_CHECK_NO_THROW(storage.addRequest(request1));
// get operation
@@ -93,7 +93,7 @@
// update operation
JsonSection json;
json.put("test", "4567");
- CertificateRequest request2(Name("/ndn/site1"), "123", RequestType::NEW, Status::CHALLENGE, cert1,
+ RequestState request2(Name("/ndn/site1"), "123", RequestType::NEW, Status::CHALLENGE, cert1,
"email", "test", time::system_clock::now(), 3, time::seconds(3600), std::move(json));
storage.updateRequest(request2);
result = storage.getRequest("123");
@@ -104,7 +104,7 @@
auto identity2 = addIdentity(Name("/ndn/site2"));
auto key2 = identity2.getDefaultKey();
auto cert2 = key2.getDefaultCertificate();
- CertificateRequest request3(Name("/ndn/site2"), "456", RequestType::NEW, Status::BEFORE_CHALLENGE, cert2);
+ RequestState request3(Name("/ndn/site2"), "456", RequestType::NEW, Status::BEFORE_CHALLENGE, cert2);
storage.addRequest(request3);
// list operation
diff --git a/tests/unit-tests/challenge-credential.t.cpp b/tests/unit-tests/challenge-credential.t.cpp
index ad2f9b3..cc5a8ac 100644
--- a/tests/unit-tests/challenge-credential.t.cpp
+++ b/tests/unit-tests/challenge-credential.t.cpp
@@ -55,7 +55,7 @@
auto identityA = addIdentity(Name("/example"));
auto keyA = identityA.getDefaultKey();
auto certA = key.getDefaultCertificate();
- CertificateRequest request(Name("/example"), "123", RequestType::NEW, Status::BEFORE_CHALLENGE, certA);
+ RequestState request(Name("/example"), "123", RequestType::NEW, Status::BEFORE_CHALLENGE, certA);
// create requester's credential
auto identityB = addIdentity(Name("/trust/cert"));
diff --git a/tests/unit-tests/challenge-email.t.cpp b/tests/unit-tests/challenge-email.t.cpp
index 8858385..9faf36d 100644
--- a/tests/unit-tests/challenge-email.t.cpp
+++ b/tests/unit-tests/challenge-email.t.cpp
@@ -45,7 +45,7 @@
auto identity = addIdentity(Name("/ndn/site1"));
auto key = identity.getDefaultKey();
auto cert = key.getDefaultCertificate();
- CertificateRequest request(Name("/ndn/site1"), "123", RequestType::NEW, Status::BEFORE_CHALLENGE, cert);
+ RequestState request(Name("/ndn/site1"), "123", RequestType::NEW, Status::BEFORE_CHALLENGE, cert);
Block paramTLV = makeEmptyBlock(tlv_encrypted_payload);
paramTLV.push_back(makeStringBlock(tlv_parameter_key, ChallengeEmail::PARAMETER_KEY_EMAIL));
@@ -94,7 +94,7 @@
auto identity = addIdentity(Name("/ndn/site1"));
auto key = identity.getDefaultKey();
auto cert = key.getDefaultCertificate();
- CertificateRequest request(Name("/ndn/site1"), "123", RequestType::NEW, Status::BEFORE_CHALLENGE, cert);
+ RequestState request(Name("/ndn/site1"), "123", RequestType::NEW, Status::BEFORE_CHALLENGE, cert);
Block paramTLV = makeEmptyBlock(tlv_encrypted_payload);
paramTLV.push_back(makeStringBlock(tlv_parameter_key, ChallengeEmail::PARAMETER_KEY_EMAIL));
@@ -113,7 +113,7 @@
auto cert = key.getDefaultCertificate();
JsonSection json;
json.put(ChallengeEmail::PARAMETER_KEY_CODE, "4567");
- CertificateRequest request(Name("/ndn/site1"), "123", RequestType::NEW, Status::CHALLENGE, cert,
+ RequestState request(Name("/ndn/site1"), "123", RequestType::NEW, Status::CHALLENGE, cert,
"email", ChallengeEmail::NEED_CODE, time::system_clock::now(),
3, time::seconds(3600), std::move(json));
@@ -135,7 +135,7 @@
auto cert = key.getDefaultCertificate();
JsonSection json;
json.put(ChallengeEmail::PARAMETER_KEY_CODE, "4567");
- CertificateRequest request(Name("/ndn/site1"), "123", RequestType::NEW, Status::CHALLENGE, cert,
+ RequestState request(Name("/ndn/site1"), "123", RequestType::NEW, Status::CHALLENGE, cert,
"email", ChallengeEmail::NEED_CODE, time::system_clock::now(),
3, time::seconds(3600), std::move(json));
diff --git a/tests/unit-tests/challenge-pin.t.cpp b/tests/unit-tests/challenge-pin.t.cpp
index f21813b..7cb3041 100644
--- a/tests/unit-tests/challenge-pin.t.cpp
+++ b/tests/unit-tests/challenge-pin.t.cpp
@@ -38,7 +38,7 @@
auto identity = addIdentity(Name("/ndn/site1"));
auto key = identity.getDefaultKey();
auto cert = key.getDefaultCertificate();
- CertificateRequest request(Name("/ndn/site1"), "123", RequestType::NEW, Status::BEFORE_CHALLENGE, cert);
+ RequestState request(Name("/ndn/site1"), "123", RequestType::NEW, Status::BEFORE_CHALLENGE, cert);
ChallengePin challenge;
challenge.handleChallengeRequest(makeEmptyBlock(tlv_encrypted_payload), request);
@@ -55,7 +55,7 @@
auto cert = key.getDefaultCertificate();
JsonSection secret;
secret.add(ChallengePin::PARAMETER_KEY_CODE, "12345");
- CertificateRequest request(Name("/ndn/site1"), "123", RequestType::NEW, Status::CHALLENGE, cert,
+ RequestState request(Name("/ndn/site1"), "123", RequestType::NEW, Status::CHALLENGE, cert,
"pin", ChallengePin::NEED_CODE, time::system_clock::now(),
3, time::seconds(3600), std::move(secret));
@@ -77,7 +77,7 @@
auto cert = key.getDefaultCertificate();
JsonSection secret;
secret.add(ChallengePin::PARAMETER_KEY_CODE, "12345");
- CertificateRequest request(Name("/ndn/site1"), "123", RequestType::NEW, Status::CHALLENGE, cert,
+ RequestState request(Name("/ndn/site1"), "123", RequestType::NEW, Status::CHALLENGE, cert,
"pin", ChallengePin::NEED_CODE, time::system_clock::now(),
3, time::seconds(3600), std::move(secret));
diff --git a/tools/ndncert-ca-server.cpp b/tools/ndncert-ca-server.cpp
index 59f4d44..1ecb532 100644
--- a/tools/ndncert-ca-server.cpp
+++ b/tools/ndncert-ca-server.cpp
@@ -82,7 +82,7 @@
CaModule ca(face, keyChain, configFilePath);
if (wantRepoOut) {
- ca.setStatusUpdateCallback([&] (const CertificateRequest& request) {
+ ca.setStatusUpdateCallback([&] (const RequestState& request) {
if (request.m_status == Status::SUCCESS && request.m_requestType == RequestType::NEW) {
auto issuedCert = request.m_cert;
boost::asio::ip::tcp::iostream requestStream;
diff --git a/tools/ndncert-ca-status.cpp b/tools/ndncert-ca-status.cpp
index 8403173..db93c69 100644
--- a/tools/ndncert-ca-status.cpp
+++ b/tools/ndncert-ca-status.cpp
@@ -53,7 +53,7 @@
}
CaSqlite storage;
- std::list<CertificateRequest> requestList;
+ std::list<RequestState> requestList;
std::list<security::v2::Certificate> certList;
if (caNameString != "") {
requestList = storage.listAllRequests(Name(caNameString));