Zhiyi Zhang | 1d3dcd2 | 2020-10-01 22:25:43 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
Davide Pesavento | 0dc0201 | 2021-11-23 22:55:03 -0500 | [diff] [blame] | 2 | /* |
Davide Pesavento | 76304d8 | 2023-08-10 23:38:06 -0400 | [diff] [blame] | 3 | * Copyright (c) 2017-2023, Regents of the University of California. |
Zhiyi Zhang | 1d3dcd2 | 2020-10-01 22:25:43 -0700 | [diff] [blame] | 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 | |
tylerliu | 4140fe8 | 2021-01-27 15:45:44 -0800 | [diff] [blame] | 21 | #ifndef NDNCERT_REQUESTER_REQUEST_HPP |
| 22 | #define NDNCERT_REQUESTER_REQUEST_HPP |
Zhiyi Zhang | 1d3dcd2 | 2020-10-01 22:25:43 -0700 | [diff] [blame] | 23 | |
tylerliu | 4140fe8 | 2021-01-27 15:45:44 -0800 | [diff] [blame] | 24 | #include "detail/ca-request-state.hpp" |
| 25 | #include "detail/crypto-helpers.hpp" |
| 26 | #include "detail/profile-storage.hpp" |
Zhiyi Zhang | 1d3dcd2 | 2020-10-01 22:25:43 -0700 | [diff] [blame] | 27 | |
Davide Pesavento | 0dc0201 | 2021-11-23 22:55:03 -0500 | [diff] [blame] | 28 | #include <ndn-cxx/security/key-chain.hpp> |
| 29 | |
Davide Pesavento | 0d1d11c | 2022-04-11 22:11:34 -0400 | [diff] [blame] | 30 | namespace ndncert::requester { |
Zhiyi Zhang | 1d3dcd2 | 2020-10-01 22:25:43 -0700 | [diff] [blame] | 31 | |
Davide Pesavento | 0dc0201 | 2021-11-23 22:55:03 -0500 | [diff] [blame] | 32 | class Request : boost::noncopyable |
Zhiyi Zhang | 1d3dcd2 | 2020-10-01 22:25:43 -0700 | [diff] [blame] | 33 | { |
| 34 | public: |
tylerliu | df6e5cc | 2020-10-05 18:52:13 -0700 | [diff] [blame] | 35 | /** |
Zhiyi Zhang | 6d9eda6 | 2020-10-16 17:37:02 -0700 | [diff] [blame] | 36 | * @brief Generates a CA profile discovery Interest following RDR protocol. |
| 37 | * |
| 38 | * @param caName The name prefix of the CA. |
Zhiyi Zhang | fbcab84 | 2020-10-07 15:17:13 -0700 | [diff] [blame] | 39 | * @return A shared pointer to an Interest ready to be sent. |
tylerliu | df6e5cc | 2020-10-05 18:52:13 -0700 | [diff] [blame] | 40 | */ |
Davide Pesavento | 0dc0201 | 2021-11-23 22:55:03 -0500 | [diff] [blame] | 41 | static std::shared_ptr<Interest> |
Zhiyi Zhang | fbcab84 | 2020-10-07 15:17:13 -0700 | [diff] [blame] | 42 | genCaProfileDiscoveryInterest(const Name& caName); |
Zhiyi Zhang | 1d3dcd2 | 2020-10-01 22:25:43 -0700 | [diff] [blame] | 43 | |
| 44 | /** |
Zhiyi Zhang | 6d9eda6 | 2020-10-16 17:37:02 -0700 | [diff] [blame] | 45 | * @brief Generates a CA profile fetching Interest following RDR protocol. |
| 46 | * |
| 47 | * @param reply The Data packet replied from discovery Interest. |
Zhiyi Zhang | fbcab84 | 2020-10-07 15:17:13 -0700 | [diff] [blame] | 48 | * @return A shared pointer to an Interest ready to be sent. |
| 49 | */ |
Davide Pesavento | 0dc0201 | 2021-11-23 22:55:03 -0500 | [diff] [blame] | 50 | static std::shared_ptr<Interest> |
Zhiyi Zhang | fbcab84 | 2020-10-07 15:17:13 -0700 | [diff] [blame] | 51 | genCaProfileInterestFromDiscoveryResponse(const Data& reply); |
| 52 | |
| 53 | /** |
Zhiyi Zhang | 6d9eda6 | 2020-10-16 17:37:02 -0700 | [diff] [blame] | 54 | * @brief Decodes the CA profile from the replied CA profile Data packet. |
| 55 | * |
Zhiyi Zhang | 1d3dcd2 | 2020-10-01 22:25:43 -0700 | [diff] [blame] | 56 | * Will first verify the signature of the packet using the key provided inside the profile. |
Zhiyi Zhang | a16b758 | 2020-10-29 18:59:46 -0700 | [diff] [blame] | 57 | * The application should be cautious whether to add CaProfile into the ProfileStorage. |
Zhiyi Zhang | 6d9eda6 | 2020-10-16 17:37:02 -0700 | [diff] [blame] | 58 | * |
| 59 | * @param reply The Data packet replied from CA profile fetching Interest. |
tylerliu | df6e5cc | 2020-10-05 18:52:13 -0700 | [diff] [blame] | 60 | * @return the CaProfile if decoding is successful |
| 61 | * @throw std::runtime_error if the decoding fails or receiving an error packet. |
Zhiyi Zhang | 1d3dcd2 | 2020-10-01 22:25:43 -0700 | [diff] [blame] | 62 | */ |
Davide Pesavento | 0d1d11c | 2022-04-11 22:11:34 -0400 | [diff] [blame] | 63 | static std::optional<CaProfile> |
Zhiyi Zhang | 1d3dcd2 | 2020-10-01 22:25:43 -0700 | [diff] [blame] | 64 | onCaProfileResponse(const Data& reply); |
| 65 | |
Zhiyi Zhang | fbcab84 | 2020-10-07 15:17:13 -0700 | [diff] [blame] | 66 | /** |
Zhiyi Zhang | 6d9eda6 | 2020-10-16 17:37:02 -0700 | [diff] [blame] | 67 | * @brief Decodes the CA profile from the replied CA profile Data packet after the redirection. |
| 68 | * |
Zhiyi Zhang | fbcab84 | 2020-10-07 15:17:13 -0700 | [diff] [blame] | 69 | * Will first verify the signature of the packet using the key provided inside the profile and |
| 70 | * verify the certificate's digest matches the one obtained from the original CA. |
Zhiyi Zhang | a16b758 | 2020-10-29 18:59:46 -0700 | [diff] [blame] | 71 | * The application should be cautious whether to add CaProfile into the ProfileStorage. |
Zhiyi Zhang | 6d9eda6 | 2020-10-16 17:37:02 -0700 | [diff] [blame] | 72 | * |
| 73 | * @param reply The Data packet replied from CA profile fetching Interest. |
| 74 | * @param caCertFullName The full name obtained from original CA's probe response. |
Zhiyi Zhang | fbcab84 | 2020-10-07 15:17:13 -0700 | [diff] [blame] | 75 | * @return the CaProfile if decoding is successful |
| 76 | * @throw std::runtime_error if the decoding fails or receiving an error packet. |
| 77 | */ |
Davide Pesavento | 0d1d11c | 2022-04-11 22:11:34 -0400 | [diff] [blame] | 78 | static std::optional<CaProfile> |
Zhiyi Zhang | 837406d | 2020-10-05 22:01:31 -0700 | [diff] [blame] | 79 | onCaProfileResponseAfterRedirection(const Data& reply, const Name& caCertFullName); |
| 80 | |
tylerliu | df6e5cc | 2020-10-05 18:52:13 -0700 | [diff] [blame] | 81 | /** |
Zhiyi Zhang | 6d9eda6 | 2020-10-16 17:37:02 -0700 | [diff] [blame] | 82 | * @brief Generates a PROBE interest to the CA (for suggested name assignments). |
| 83 | * |
| 84 | * @param ca The CA that interest is send to |
| 85 | * @param probeInfo The requester information to carry to the CA |
tylerliu | df6e5cc | 2020-10-05 18:52:13 -0700 | [diff] [blame] | 86 | * @return A shared pointer of to the encoded interest, ready to be sent. |
| 87 | */ |
Davide Pesavento | 0dc0201 | 2021-11-23 22:55:03 -0500 | [diff] [blame] | 88 | static std::shared_ptr<Interest> |
tylerliu | 4022633 | 2020-11-11 15:37:16 -0800 | [diff] [blame] | 89 | genProbeInterest(const CaProfile& ca, std::multimap<std::string, std::string>&& probeInfo); |
Zhiyi Zhang | 1d3dcd2 | 2020-10-01 22:25:43 -0700 | [diff] [blame] | 90 | |
tylerliu | df6e5cc | 2020-10-05 18:52:13 -0700 | [diff] [blame] | 91 | /** |
Zhiyi Zhang | 6d9eda6 | 2020-10-16 17:37:02 -0700 | [diff] [blame] | 92 | * @brief Decodes the replied data for PROBE process from the CA. |
| 93 | * |
tylerliu | df6e5cc | 2020-10-05 18:52:13 -0700 | [diff] [blame] | 94 | * Will first verify the signature of the packet using the key provided inside the profile. |
Zhiyi Zhang | 6d9eda6 | 2020-10-16 17:37:02 -0700 | [diff] [blame] | 95 | * |
| 96 | * @param reply The replied data packet |
| 97 | * @param ca the profile of the CA that replies the packet |
| 98 | * @param identityNames The vector to load the decoded identity names from the data. |
| 99 | * @param otherCas The vector to load the decoded redirection CA prefixes from the data. |
tylerliu | df6e5cc | 2020-10-05 18:52:13 -0700 | [diff] [blame] | 100 | * @throw std::runtime_error if the decoding fails or receiving an error packet. |
| 101 | */ |
Zhiyi Zhang | 1d3dcd2 | 2020-10-01 22:25:43 -0700 | [diff] [blame] | 102 | static void |
| 103 | onProbeResponse(const Data& reply, const CaProfile& ca, |
tylerliu | b47dad7 | 2020-10-08 21:36:55 -0700 | [diff] [blame] | 104 | std::vector<std::pair<Name, int>>& identityNames, std::vector<Name>& otherCas); |
Zhiyi Zhang | 1d3dcd2 | 2020-10-01 22:25:43 -0700 | [diff] [blame] | 105 | |
tylerliu | 4140fe8 | 2021-01-27 15:45:44 -0800 | [diff] [blame] | 106 | explicit |
Davide Pesavento | 0dc0201 | 2021-11-23 22:55:03 -0500 | [diff] [blame] | 107 | Request(ndn::KeyChain& keyChain, const CaProfile& profile, RequestType requestType); |
tylerliu | 4140fe8 | 2021-01-27 15:45:44 -0800 | [diff] [blame] | 108 | |
Zhiyi Zhang | 1d3dcd2 | 2020-10-01 22:25:43 -0700 | [diff] [blame] | 109 | // NEW/REVOKE/RENEW related helpers |
tylerliu | df6e5cc | 2020-10-05 18:52:13 -0700 | [diff] [blame] | 110 | /** |
Zhiyi Zhang | 6d9eda6 | 2020-10-16 17:37:02 -0700 | [diff] [blame] | 111 | * @brief Generates a NEW interest to the CA. |
| 112 | * |
| 113 | * @param state The current requester state for this request. Will be modified in the function. |
Tianyuan Yu | ca23bb0 | 2022-03-09 14:09:14 -0800 | [diff] [blame] | 114 | * @param keyName The key name to be requested. |
Zhiyi Zhang | 6d9eda6 | 2020-10-16 17:37:02 -0700 | [diff] [blame] | 115 | * @param notBefore The expected notBefore field for the certificate (starting time) |
| 116 | * @param notAfter The expected notAfter field for the certificate (expiration time) |
tylerliu | df6e5cc | 2020-10-05 18:52:13 -0700 | [diff] [blame] | 117 | * @return The shared pointer to the encoded interest. |
| 118 | */ |
Davide Pesavento | 0dc0201 | 2021-11-23 22:55:03 -0500 | [diff] [blame] | 119 | std::shared_ptr<Interest> |
Tianyuan Yu | ca23bb0 | 2022-03-09 14:09:14 -0800 | [diff] [blame] | 120 | genNewInterest(const Name& keyName, |
Davide Pesavento | 76304d8 | 2023-08-10 23:38:06 -0400 | [diff] [blame] | 121 | const time::system_clock::time_point& notBefore, |
| 122 | const time::system_clock::time_point& notAfter); |
Zhiyi Zhang | 1d3dcd2 | 2020-10-01 22:25:43 -0700 | [diff] [blame] | 123 | |
tylerliu | df6e5cc | 2020-10-05 18:52:13 -0700 | [diff] [blame] | 124 | /** |
Zhiyi Zhang | 6d9eda6 | 2020-10-16 17:37:02 -0700 | [diff] [blame] | 125 | * @brief Generates a REVOKE interest to the CA. |
| 126 | * |
Zhiyi Zhang | 6d9eda6 | 2020-10-16 17:37:02 -0700 | [diff] [blame] | 127 | * @param certificate The certificate to the revoked. |
tylerliu | df6e5cc | 2020-10-05 18:52:13 -0700 | [diff] [blame] | 128 | * @return The shared pointer to the encoded interest. |
| 129 | */ |
Davide Pesavento | 0dc0201 | 2021-11-23 22:55:03 -0500 | [diff] [blame] | 130 | std::shared_ptr<Interest> |
| 131 | genRevokeInterest(const Certificate& certificate); |
Zhiyi Zhang | 1d3dcd2 | 2020-10-01 22:25:43 -0700 | [diff] [blame] | 132 | |
tylerliu | df6e5cc | 2020-10-05 18:52:13 -0700 | [diff] [blame] | 133 | /** |
Zhiyi Zhang | 6d9eda6 | 2020-10-16 17:37:02 -0700 | [diff] [blame] | 134 | * @brief Decodes the replied data of NEW, RENEW, or REVOKE interest from the CA. |
| 135 | * |
Zhiyi Zhang | 6d9eda6 | 2020-10-16 17:37:02 -0700 | [diff] [blame] | 136 | * @param reply The replied data from the network |
tylerliu | df6e5cc | 2020-10-05 18:52:13 -0700 | [diff] [blame] | 137 | * @return the list of challenge accepted by the CA, for CHALLENGE step. |
| 138 | * @throw std::runtime_error if the decoding fails or receiving an error packet. |
| 139 | */ |
tylerliu | 4140fe8 | 2021-01-27 15:45:44 -0800 | [diff] [blame] | 140 | std::list<std::string> |
| 141 | onNewRenewRevokeResponse(const Data& reply); |
Zhiyi Zhang | 1d3dcd2 | 2020-10-01 22:25:43 -0700 | [diff] [blame] | 142 | |
| 143 | // CHALLENGE helpers |
tylerliu | df6e5cc | 2020-10-05 18:52:13 -0700 | [diff] [blame] | 144 | /** |
Zhiyi Zhang | 6d9eda6 | 2020-10-16 17:37:02 -0700 | [diff] [blame] | 145 | * @brief Generates the required parameter for the selected challenge for the request |
| 146 | * |
Davide Pesavento | 76304d8 | 2023-08-10 23:38:06 -0400 | [diff] [blame] | 147 | * @param challengeSelected The selected challenge for the request. |
| 148 | * Can use state.m_challengeType to continue. |
tylerliu | df6e5cc | 2020-10-05 18:52:13 -0700 | [diff] [blame] | 149 | * @return The requirement list for the current stage of the challenge, in name, prompt mapping. |
Zhiyi Zhang | c5d93a9 | 2020-10-14 17:07:35 -0700 | [diff] [blame] | 150 | * @throw std::runtime_error if the challenge is not supported. |
tylerliu | df6e5cc | 2020-10-05 18:52:13 -0700 | [diff] [blame] | 151 | */ |
tylerliu | 4140fe8 | 2021-01-27 15:45:44 -0800 | [diff] [blame] | 152 | std::multimap<std::string, std::string> |
| 153 | selectOrContinueChallenge(const std::string& challengeSelected); |
Zhiyi Zhang | 1d3dcd2 | 2020-10-01 22:25:43 -0700 | [diff] [blame] | 154 | |
tylerliu | df6e5cc | 2020-10-05 18:52:13 -0700 | [diff] [blame] | 155 | /** |
Zhiyi Zhang | 6d9eda6 | 2020-10-16 17:37:02 -0700 | [diff] [blame] | 156 | * @brief Generates the CHALLENGE interest for the request. |
| 157 | * |
Davide Pesavento | 76304d8 | 2023-08-10 23:38:06 -0400 | [diff] [blame] | 158 | * @param parameters The requirement list, in name, value mapping. |
tylerliu | df6e5cc | 2020-10-05 18:52:13 -0700 | [diff] [blame] | 159 | * @return The shared pointer to the encoded interest |
Zhiyi Zhang | c5d93a9 | 2020-10-14 17:07:35 -0700 | [diff] [blame] | 160 | * @throw std::runtime_error if the challenge is not selected or is not supported. |
tylerliu | df6e5cc | 2020-10-05 18:52:13 -0700 | [diff] [blame] | 161 | */ |
Davide Pesavento | 0dc0201 | 2021-11-23 22:55:03 -0500 | [diff] [blame] | 162 | std::shared_ptr<Interest> |
tylerliu | 4140fe8 | 2021-01-27 15:45:44 -0800 | [diff] [blame] | 163 | genChallengeInterest(std::multimap<std::string, std::string>&& parameters); |
Zhiyi Zhang | 1d3dcd2 | 2020-10-01 22:25:43 -0700 | [diff] [blame] | 164 | |
tylerliu | df6e5cc | 2020-10-05 18:52:13 -0700 | [diff] [blame] | 165 | /** |
Zhiyi Zhang | 6d9eda6 | 2020-10-16 17:37:02 -0700 | [diff] [blame] | 166 | * @brief Decodes the responded data from the CHALLENGE interest. |
| 167 | * |
Davide Pesavento | 76304d8 | 2023-08-10 23:38:06 -0400 | [diff] [blame] | 168 | * @param reply The response data. |
tylerliu | df6e5cc | 2020-10-05 18:52:13 -0700 | [diff] [blame] | 169 | * @throw std::runtime_error if the decoding fails or receiving an error packet. |
| 170 | */ |
tylerliu | 4140fe8 | 2021-01-27 15:45:44 -0800 | [diff] [blame] | 171 | void |
| 172 | onChallengeResponse(const Data& reply); |
Zhiyi Zhang | 1d3dcd2 | 2020-10-01 22:25:43 -0700 | [diff] [blame] | 173 | |
tylerliu | df6e5cc | 2020-10-05 18:52:13 -0700 | [diff] [blame] | 174 | /** |
Zhiyi Zhang | 6d9eda6 | 2020-10-16 17:37:02 -0700 | [diff] [blame] | 175 | * @brief Generate the interest to fetch the issued certificate |
| 176 | * |
tylerliu | df6e5cc | 2020-10-05 18:52:13 -0700 | [diff] [blame] | 177 | * @return The shared pointer to the encoded interest |
| 178 | */ |
Davide Pesavento | 0dc0201 | 2021-11-23 22:55:03 -0500 | [diff] [blame] | 179 | std::shared_ptr<Interest> |
tylerliu | 4140fe8 | 2021-01-27 15:45:44 -0800 | [diff] [blame] | 180 | genCertFetchInterest() const; |
Zhiyi Zhang | 1d3dcd2 | 2020-10-01 22:25:43 -0700 | [diff] [blame] | 181 | |
tylerliu | df6e5cc | 2020-10-05 18:52:13 -0700 | [diff] [blame] | 182 | /** |
Zhiyi Zhang | 6d9eda6 | 2020-10-16 17:37:02 -0700 | [diff] [blame] | 183 | * @brief Decoded and installs the response certificate from the certificate fetch. |
| 184 | * |
Davide Pesavento | 76304d8 | 2023-08-10 23:38:06 -0400 | [diff] [blame] | 185 | * @param reply The data replied from the certificate fetch interest. |
tylerliu | df6e5cc | 2020-10-05 18:52:13 -0700 | [diff] [blame] | 186 | * @return The shared pointer to the certificate being fetched. |
| 187 | */ |
Davide Pesavento | 0dc0201 | 2021-11-23 22:55:03 -0500 | [diff] [blame] | 188 | static std::shared_ptr<Certificate> |
Zhiyi Zhang | 1d3dcd2 | 2020-10-01 22:25:43 -0700 | [diff] [blame] | 189 | onCertFetchResponse(const Data& reply); |
| 190 | |
Zhiyi Zhang | 1d3dcd2 | 2020-10-01 22:25:43 -0700 | [diff] [blame] | 191 | private: |
| 192 | static void |
| 193 | processIfError(const Data& data); |
tylerliu | 4140fe8 | 2021-01-27 15:45:44 -0800 | [diff] [blame] | 194 | |
| 195 | public: |
| 196 | /** |
| 197 | * @brief The CA profile for this request. |
| 198 | */ |
Zhiyi Zhang | 6499edd | 2021-02-17 22:37:21 -0800 | [diff] [blame] | 199 | CaProfile m_caProfile; |
tylerliu | 4140fe8 | 2021-01-27 15:45:44 -0800 | [diff] [blame] | 200 | /** |
| 201 | * @brief The type of request. Either NEW, RENEW, or REVOKE. |
| 202 | */ |
Zhiyi Zhang | 6499edd | 2021-02-17 22:37:21 -0800 | [diff] [blame] | 203 | RequestType m_type; |
tylerliu | 4140fe8 | 2021-01-27 15:45:44 -0800 | [diff] [blame] | 204 | /** |
| 205 | * @brief The identity name for the requesting certificate. |
| 206 | */ |
Zhiyi Zhang | 6499edd | 2021-02-17 22:37:21 -0800 | [diff] [blame] | 207 | Name m_identityName; |
tylerliu | 4140fe8 | 2021-01-27 15:45:44 -0800 | [diff] [blame] | 208 | /** |
| 209 | * @brief The CA-generated request ID for the request. |
| 210 | */ |
Zhiyi Zhang | 6499edd | 2021-02-17 22:37:21 -0800 | [diff] [blame] | 211 | RequestId m_requestId; |
tylerliu | 4140fe8 | 2021-01-27 15:45:44 -0800 | [diff] [blame] | 212 | /** |
| 213 | * @brief The current status of the request. |
| 214 | */ |
Zhiyi Zhang | 6499edd | 2021-02-17 22:37:21 -0800 | [diff] [blame] | 215 | Status m_status = Status::BEFORE_CHALLENGE; |
tylerliu | 4140fe8 | 2021-01-27 15:45:44 -0800 | [diff] [blame] | 216 | /** |
| 217 | * @brief The type of challenge chosen. |
| 218 | */ |
Zhiyi Zhang | 6499edd | 2021-02-17 22:37:21 -0800 | [diff] [blame] | 219 | std::string m_challengeType; |
tylerliu | 4140fe8 | 2021-01-27 15:45:44 -0800 | [diff] [blame] | 220 | /** |
| 221 | * @brief The status of the current challenge. |
| 222 | */ |
Zhiyi Zhang | 6499edd | 2021-02-17 22:37:21 -0800 | [diff] [blame] | 223 | std::string m_challengeStatus; |
tylerliu | 4140fe8 | 2021-01-27 15:45:44 -0800 | [diff] [blame] | 224 | /** |
| 225 | * @brief The remaining number of tries left for the challenge |
| 226 | */ |
Zhiyi Zhang | 6499edd | 2021-02-17 22:37:21 -0800 | [diff] [blame] | 227 | int m_remainingTries = 0; |
tylerliu | 4140fe8 | 2021-01-27 15:45:44 -0800 | [diff] [blame] | 228 | /** |
| 229 | * @brief The time this challenge will remain fresh |
| 230 | */ |
Davide Pesavento | 76304d8 | 2023-08-10 23:38:06 -0400 | [diff] [blame] | 231 | time::system_clock::time_point m_freshBefore; |
tylerliu | 4140fe8 | 2021-01-27 15:45:44 -0800 | [diff] [blame] | 232 | /** |
| 233 | * @brief the name of the certificate being issued. |
| 234 | */ |
Zhiyi Zhang | 6499edd | 2021-02-17 22:37:21 -0800 | [diff] [blame] | 235 | Name m_issuedCertName; |
tylerliu | 4140fe8 | 2021-01-27 15:45:44 -0800 | [diff] [blame] | 236 | /** |
Tianyuan Yu | 6077555 | 2022-03-07 17:10:10 -0800 | [diff] [blame] | 237 | * @brief The optional forwarding hint. |
| 238 | */ |
| 239 | Name m_forwardingHint; |
| 240 | /** |
tylerliu | 4140fe8 | 2021-01-27 15:45:44 -0800 | [diff] [blame] | 241 | * @brief ecdh state. |
| 242 | */ |
Zhiyi Zhang | 6499edd | 2021-02-17 22:37:21 -0800 | [diff] [blame] | 243 | ECDHState m_ecdh; |
tylerliu | 4140fe8 | 2021-01-27 15:45:44 -0800 | [diff] [blame] | 244 | /** |
| 245 | * @brief AES key derived from the ecdh shared secret. |
| 246 | */ |
Zhiyi Zhang | 6499edd | 2021-02-17 22:37:21 -0800 | [diff] [blame] | 247 | std::array<uint8_t, 16> m_aesKey = {}; |
tylerliu | 4140fe8 | 2021-01-27 15:45:44 -0800 | [diff] [blame] | 248 | /** |
| 249 | * @brief The last Initialization Vector used by the AES encryption. |
| 250 | */ |
Zhiyi Zhang | 6499edd | 2021-02-17 22:37:21 -0800 | [diff] [blame] | 251 | std::vector<uint8_t> m_encryptionIv; |
tylerliu | 4140fe8 | 2021-01-27 15:45:44 -0800 | [diff] [blame] | 252 | /** |
| 253 | * @brief The last Initialization Vector used by the other side's AES encryption. |
| 254 | */ |
Zhiyi Zhang | 6499edd | 2021-02-17 22:37:21 -0800 | [diff] [blame] | 255 | std::vector<uint8_t> m_decryptionIv; |
tylerliu | 4140fe8 | 2021-01-27 15:45:44 -0800 | [diff] [blame] | 256 | /** |
| 257 | * @brief Store Nonce for signature |
| 258 | */ |
Zhiyi Zhang | 6499edd | 2021-02-17 22:37:21 -0800 | [diff] [blame] | 259 | std::array<uint8_t, 16> m_nonce = {}; |
Zhiyi Zhang | 3f1c7cf | 2021-02-17 14:08:14 -0800 | [diff] [blame] | 260 | |
tylerliu | 4140fe8 | 2021-01-27 15:45:44 -0800 | [diff] [blame] | 261 | private: |
| 262 | /** |
| 263 | * @brief The local keychain to generate and install identities, keys and certificates |
| 264 | */ |
Davide Pesavento | 0dc0201 | 2021-11-23 22:55:03 -0500 | [diff] [blame] | 265 | ndn::KeyChain& m_keyChain; |
tylerliu | 4140fe8 | 2021-01-27 15:45:44 -0800 | [diff] [blame] | 266 | /** |
tylerliu | 4140fe8 | 2021-01-27 15:45:44 -0800 | [diff] [blame] | 267 | * @brief The keypair for the request. |
| 268 | */ |
Davide Pesavento | 0dc0201 | 2021-11-23 22:55:03 -0500 | [diff] [blame] | 269 | ndn::security::Key m_keyPair; |
Zhiyi Zhang | 1d3dcd2 | 2020-10-01 22:25:43 -0700 | [diff] [blame] | 270 | }; |
| 271 | |
Davide Pesavento | 0d1d11c | 2022-04-11 22:11:34 -0400 | [diff] [blame] | 272 | } // namespace ndncert::requester |
Zhiyi Zhang | 1d3dcd2 | 2020-10-01 22:25:43 -0700 | [diff] [blame] | 273 | |
tylerliu | 4140fe8 | 2021-01-27 15:45:44 -0800 | [diff] [blame] | 274 | #endif // NDNCERT_REQUESTER_REQUEST_HPP |