| /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| /* |
| * Copyright (c) 2017-2022, 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_DETAIL_CA_PROFILE_HPP |
| #define NDNCERT_DETAIL_CA_PROFILE_HPP |
| |
| #include "detail/ndncert-common.hpp" |
| |
| namespace ndncert { |
| |
| // used in parsing CA configuration file and Client CA profile storage file |
| const std::string CONFIG_CA_PREFIX = "ca-prefix"; |
| const std::string CONFIG_CA_INFO = "ca-info"; |
| const std::string CONFIG_MAX_VALIDITY_PERIOD = "max-validity-period"; |
| const std::string CONFIG_MAX_SUFFIX_LENGTH = "max-suffix-length"; |
| const std::string CONFIG_PROBE_PARAMETERS = "probe-parameters"; |
| const std::string CONFIG_PROBE_PARAMETER = "probe-parameter-key"; |
| const std::string CONFIG_SUPPORTED_CHALLENGES = "supported-challenges"; |
| const std::string CONFIG_CHALLENGE = "challenge"; |
| const std::string CONFIG_CERTIFICATE = "certificate"; |
| const std::string CONFIG_REDIRECTION = "redirect-to"; |
| const std::string CONFIG_NAME_ASSIGNMENT = "name-assignment"; |
| const std::string CONFIG_REDIRECTION_POLICY_TYPE = "policy-type"; |
| const std::string CONFIG_REDIRECTION_POLICY_PARAM = "policy-param"; |
| |
| class CaProfile |
| { |
| public: |
| /** |
| * Parse the configuration json. |
| * @param configJson the configuration json to parse |
| * @return the CaProfile according to this json |
| */ |
| static CaProfile |
| fromJson(const JsonSection& json); |
| |
| /** |
| * @return the JSON representation of this profile. |
| */ |
| JsonSection |
| toJson() const; |
| |
| public: |
| /** |
| * @brief CA Name prefix (without /CA suffix). |
| */ |
| Name caPrefix; |
| /** |
| * @brief CA Information. |
| */ |
| std::string caInfo; |
| /** |
| * @brief A list of parameter-keys for PROBE. |
| */ |
| std::vector<std::string> probeParameterKeys; |
| /** |
| * @brief Maximum allowed validity period of the certificate being requested. |
| * |
| * The value is in the unit of second. |
| * Default: one day (86400 seconds). |
| */ |
| time::seconds maxValidityPeriod; |
| /** |
| * @brief Maximum allowed suffix length of requested name. |
| * |
| * E.g., When its value is 2, at most 2 name components can be assigned after m_caPrefix. |
| * Default: none. |
| */ |
| optional<size_t> maxSuffixLength = nullopt; |
| /** |
| * @brief A list of supported challenges. Only CA side will have m_supportedChallenges. |
| */ |
| std::vector<std::string> supportedChallenges; |
| /** |
| * @brief CA's certificate. Only Client side will have m_cert. |
| */ |
| std::shared_ptr<Certificate> cert; |
| }; |
| |
| } // namespace ndncert |
| |
| #endif // NDNCERT_DETAIL_CA_PROFILE_HPP |