blob: 8a254c6f984c27ca46033263dcf1cd7617b66af5 [file] [log] [blame]
Zhiyi Zhangf2306f72020-10-09 11:26:05 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (c) 2017-2020, Regents of the University of California.
4 *
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
21#ifndef NDNCERT_REQUESTER_STATE_HPP
22#define NDNCERT_REQUESTER_STATE_HPP
23
Zhiyi Zhangc5d93a92020-10-14 17:07:35 -070024#include "protocol-detail/ndncert-common.hpp"
25#include "protocol-detail/crypto-helper.hpp"
Zhiyi Zhangf2306f72020-10-09 11:26:05 -070026#include "configuration.hpp"
27
28namespace ndn {
29namespace ndncert {
30
31struct RequesterState {
32 explicit
33 RequesterState(security::KeyChain& keyChain, const CaProfile& caItem, RequestType requestType);
34
35 /**
36 * The CA profile for this request.
37 */
38 CaProfile m_caItem;
39 /**
40 * The local keychain to generate and install identities, keys and certificates
41 */
42 security::KeyChain& m_keyChain;
43 /**
44 * The type of request. Either NEW, RENEW, or REVOKE.
45 */
46 RequestType m_type;
Zhiyi Zhangf2306f72020-10-09 11:26:05 -070047 /**
48 * The identity name for the requesting certificate.
49 */
50 Name m_identityName;
51 /**
52 * The keypair for the request.
53 */
54 security::Key m_keyPair;
55 /**
56 * The CA-generated request ID for the request.
57 */
58 std::string m_requestId;
59 /**
60 * The current status of the request.
61 */
62 Status m_status = Status::NOT_STARTED;
Zhiyi Zhangf2306f72020-10-09 11:26:05 -070063 /**
64 * The type of challenge chosen.
65 */
66 std::string m_challengeType;
67 /**
68 * The status of the current challenge.
69 */
70 std::string m_challengeStatus;
71 /**
72 * The remaining number of tries left for the challenge
73 */
74 int m_remainingTries = 0;
75 /**
76 * The time this challenge will remain fresh
77 */
78 time::system_clock::TimePoint m_freshBefore;
79 /**
80 * the name of the certificate being issued.
81 */
82 Name m_issuedCertName;
83 /**
84 * ecdh state.
85 */
86 ECDHState m_ecdh;
87 /**
88 * AES key derived from the ecdh shared secret.
89 */
90 uint8_t m_aesKey[16] = {0};
91 /**
92 * State about how identity/key is generated.
93 */
94 bool m_isNewlyCreatedIdentity = false;
95 bool m_isNewlyCreatedKey = false;
96};
97
Zhiyi Zhange4891b72020-10-10 15:11:57 -070098} // namespace ndncert
99} // namespace ndn
Zhiyi Zhangf2306f72020-10-09 11:26:05 -0700100
Zhiyi Zhange4891b72020-10-10 15:11:57 -0700101#endif // NDNCERT_REQUESTER_STATE_HPP