blob: 72194db4af3adfbd5b34a23f227330fa5b482dad [file] [log] [blame]
tylerliu182bc532020-09-25 01:54:45 -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
Zhiyi Zhangc5d93a92020-10-14 17:07:35 -070021#ifndef NDNCERT_PROTOCOL_DETAIL_NEW_RENEW_REVOKE_ENCODER_HPP
22#define NDNCERT_PROTOCOL_DETAIL_NEW_RENEW_REVOKE_ENCODER_HPP
tylerliu182bc532020-09-25 01:54:45 -070023
Zhiyi Zhang062be6d2020-10-14 17:13:43 -070024#include "../detail/ca-state.hpp"
tylerliu182bc532020-09-25 01:54:45 -070025
26namespace ndn {
27namespace ndncert {
28
Zhiyi Zhang8f1ade32020-10-14 16:42:57 -070029class NewRenewRevokeEncoder
Zhiyi Zhang684c67c2020-10-12 14:28:17 -070030{
tylerliu182bc532020-09-25 01:54:45 -070031public:
32 static Block
tylerliua7bea662020-10-08 18:51:02 -070033 encodeApplicationParameters(RequestType requestType, const std::string& ecdhPub, const security::Certificate& certRequest);
tylerliu182bc532020-09-25 01:54:45 -070034
tylerliu0790bdb2020-10-02 00:50:51 -070035 static void
tylerliua7bea662020-10-08 18:51:02 -070036 decodeApplicationParameters(const Block& block, RequestType requestType, std::string& ecdhPub, shared_ptr<security::Certificate>& certRequest);
tylerliu0790bdb2020-10-02 00:50:51 -070037
tylerliu182bc532020-09-25 01:54:45 -070038 static Block
Zhiyi Zhangc9f9fac2020-10-18 19:51:51 -070039 encodeDataContent(const std::string& ecdhKey, const std::array<uint8_t, 32>& salt,
Zhiyi Zhang8fdb36b2020-10-18 11:58:51 -070040 const CaState& request,
41 const std::list<std::string>& challenges);
42
tylerliu0790bdb2020-10-02 00:50:51 -070043 struct DecodedData {
44 std::string ecdhKey;
Zhiyi Zhangc9f9fac2020-10-18 19:51:51 -070045 std::array<uint8_t, 32> salt;
Zhiyi Zhang8fdb36b2020-10-18 11:58:51 -070046 RequestID requestId;
tylerliu0790bdb2020-10-02 00:50:51 -070047 Status requestStatus;
48 std::list<std::string> challenges;
49 };
50 static DecodedData
51 decodeDataContent(const Block& content);
tylerliu182bc532020-09-25 01:54:45 -070052};
53
Zhiyi Zhange4891b72020-10-10 15:11:57 -070054} // namespace ndncert
55} // namespace ndn
tylerliu182bc532020-09-25 01:54:45 -070056
Zhiyi Zhangc5d93a92020-10-14 17:07:35 -070057#endif // NDNCERT_PROTOCOL_DETAIL_NEW_RENEW_REVOKE_HPP