blob: 8fa5a0def9b0c00bd132667da26e0b4d6a7e40c2 [file] [log] [blame]
Zhiyi Zhanga41c5732017-01-18 14:06:44 -08001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
Zhiyi Zhangaf7c2902019-03-14 22:13:21 -07003 * Copyright (c) 2017-2019, Regents of the University of California.
Zhiyi Zhanga41c5732017-01-18 14:06:44 -08004 *
5 * This file is part of ndncert, a certificate management system based on NDN.
6 *
7 * ndncert is free software: you can redistribute it and/or modify it under the terms
8 * of the GNU General Public License as published by the Free Software Foundation, either
9 * version 3 of the License, or (at your option) any later version.
10 *
11 * ndncert is distributed in the hope that it will be useful, but WITHOUT ANY
12 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13 * PARTICULAR PURPOSE. See the GNU General Public License for more details.
14 *
15 * You should have received copies of the GNU General Public License along with
16 * ndncert, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * See AUTHORS.md for complete list of ndncert authors and contributors.
19 */
20
Zhiyi Zhang00a4a002017-03-01 10:17:36 -080021#ifndef NDNCERT_CERTIFICATE_REQUEST_HPP
22#define NDNCERT_CERTIFICATE_REQUEST_HPP
Zhiyi Zhanga41c5732017-01-18 14:06:44 -080023
24#include "ndncert-common.hpp"
25#include <ndn-cxx/security/v2/certificate.hpp>
26
27namespace ndn {
28namespace ndncert {
29
Zhiyi Zhang3b267e62017-02-09 17:59:34 -080030typedef boost::property_tree::ptree JsonSection;
31
Zhiyi Zhanga41c5732017-01-18 14:06:44 -080032/**
33 * @brief Represents a certificate request instance.
34 *
35 * ChallengeModule should take use of m_challengeStatus, m_challengeInstruction and
36 * m_challengeDefinedField to finish verification.
37 *
38 */
39class CertificateRequest
40{
41public:
Zhiyi Zhang00a4a002017-03-01 10:17:36 -080042 CertificateRequest();
Zhiyi Zhangaf7c2902019-03-14 22:13:21 -070043 CertificateRequest(const Name& caName, const std::string& requestId, int status, const security::v2::Certificate& cert);
44 CertificateRequest(const Name& caName, const std::string& requestId, int status,
45 const std::string& challengeStatus, const std::string& challengeType,
46 const std::string& challengeTp, int remainingTime, int remainingTries,
47 const JsonSection& challengeSecrets, const security::v2::Certificate& cert);
48public:
Zhiyi Zhanga41c5732017-01-18 14:06:44 -080049 Name m_caName;
Zhiyi Zhangaf7c2902019-03-14 22:13:21 -070050 std::string m_requestId = "";
51 int m_status = -1;
Zhiyi Zhanga41c5732017-01-18 14:06:44 -080052 security::v2::Certificate m_cert;
Zhiyi Zhangaf7c2902019-03-14 22:13:21 -070053
54 std::string m_challengeStatus = "";
55 std::string m_challengeType = "";
56 std::string m_challengeTp = "";
57 int m_remainingTime = 0;
58 int m_remainingTries = 0;
59 JsonSection m_challengeSecrets;
Zhiyi Zhanga41c5732017-01-18 14:06:44 -080060};
61
62std::ostream&
Zhiyi Zhanga41c5732017-01-18 14:06:44 -080063operator<<(std::ostream& os, const CertificateRequest& request);
64
65} // namespace ndncert
66} // namespace ndn
67
Zhiyi Zhang00a4a002017-03-01 10:17:36 -080068#endif // NDNCERT_CERTIFICATE_REQUEST_HPP