blob: 5d87ea343f2d6f1dd61dd0a9c0f9bd218c5622c8 [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
24#include "ndncert-common.hpp"
25#include "crypto-support/crypto-helper.hpp"
26#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;
47
48 /**
49 * The identity name for the requesting certificate.
50 */
51 Name m_identityName;
52 /**
53 * The keypair for the request.
54 */
55 security::Key m_keyPair;
56 /**
57 * The CA-generated request ID for the request.
58 */
59 std::string m_requestId;
60 /**
61 * The current status of the request.
62 */
63 Status m_status = Status::NOT_STARTED;
64
65 /**
66 * The type of challenge chosen.
67 */
68 std::string m_challengeType;
69 /**
70 * The status of the current challenge.
71 */
72 std::string m_challengeStatus;
73 /**
74 * The remaining number of tries left for the challenge
75 */
76 int m_remainingTries = 0;
77 /**
78 * The time this challenge will remain fresh
79 */
80 time::system_clock::TimePoint m_freshBefore;
81 /**
82 * the name of the certificate being issued.
83 */
84 Name m_issuedCertName;
85 /**
86 * ecdh state.
87 */
88 ECDHState m_ecdh;
89 /**
90 * AES key derived from the ecdh shared secret.
91 */
92 uint8_t m_aesKey[16] = {0};
93 /**
94 * State about how identity/key is generated.
95 */
96 bool m_isNewlyCreatedIdentity = false;
97 bool m_isNewlyCreatedKey = false;
98};
99
100} // namespace ndncert
101} // namespace ndn
102
103#endif // NDNCERT_REQUESTER_STATE_HPP