| /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| /** |
| * Copyright (c) 2017-2020, Regents of the University of California. |
| * |
| * This file is part of ndncert, a certificate management system based on NDN. |
| * |
| * ndncert is free software: you can redistribute it and/or modify it under the terms |
| * of the GNU General Public License as published by the Free Software Foundation, either |
| * version 3 of the License, or (at your option) any later version. |
| * |
| * ndncert is distributed in the hope that it will be useful, but WITHOUT ANY |
| * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
| * PARTICULAR PURPOSE. See the GNU General Public License for more details. |
| * |
| * You should have received copies of the GNU General Public License along with |
| * ndncert, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>. |
| * |
| * See AUTHORS.md for complete list of ndncert authors and contributors. |
| */ |
| |
| #ifndef NDNCERT_REQUESTER_REQUEST_STATE_HPP |
| #define NDNCERT_REQUESTER_REQUEST_STATE_HPP |
| |
| #include "detail/ca-request-state.hpp" |
| #include "detail/crypto-helpers.hpp" |
| #include "detail/profile-storage.hpp" |
| |
| namespace ndn { |
| namespace ndncert { |
| namespace requester { |
| |
| struct RequestState { |
| explicit |
| RequestState(security::KeyChain& keyChain, const CaProfile& profile, RequestType requestType); |
| |
| /** |
| * @brief The CA profile for this request. |
| */ |
| CaProfile caProfile; |
| /** |
| * @brief The local keychain to generate and install identities, keys and certificates |
| */ |
| security::KeyChain& keyChain; |
| /** |
| * @brief The type of request. Either NEW, RENEW, or REVOKE. |
| */ |
| RequestType type; |
| /** |
| * @brief The identity name for the requesting certificate. |
| */ |
| Name identityName; |
| /** |
| * @brief The keypair for the request. |
| */ |
| security::Key keyPair; |
| /** |
| * @brief The CA-generated request ID for the request. |
| */ |
| RequestId requestId; |
| /** |
| * @brief The current status of the request. |
| */ |
| Status status = Status::BEFORE_CHALLENGE; |
| /** |
| * @brief The type of challenge chosen. |
| */ |
| std::string challengeType; |
| /** |
| * @brief The status of the current challenge. |
| */ |
| std::string challengeStatus; |
| /** |
| * @brief The remaining number of tries left for the challenge |
| */ |
| int remainingTries = 0; |
| /** |
| * @brief The time this challenge will remain fresh |
| */ |
| time::system_clock::TimePoint freshBefore; |
| /** |
| * @brief the name of the certificate being issued. |
| */ |
| Name issuedCertName; |
| /** |
| * @brief ecdh state. |
| */ |
| ECDHState ecdh; |
| /** |
| * @brief AES key derived from the ecdh shared secret. |
| */ |
| std::array<uint8_t, 16> aesKey = {}; |
| /** |
| * @brief The last Initialization Vector used by the AES encryption. |
| */ |
| std::vector<uint8_t> encryptionIv; |
| /** |
| * @brief The last Initialization Vector used by the other side's AES encryption. |
| */ |
| std::vector<uint8_t> decryptionIv; |
| /** |
| * @brief State about how identity/key is generated. |
| */ |
| bool isNewlyCreatedIdentity = false; |
| bool isNewlyCreatedKey = false; |
| /** |
| * @brief Store Nonce for signature |
| */ |
| std::array<uint8_t, 16> nonce = {}; |
| }; |
| |
| } // namespace requester |
| } // namespace ndncert |
| } // namespace ndn |
| |
| #endif // NDNCERT_REQUESTER_REQUEST_STATE_HPP |