blob: 62bbb5a41fcc8001c71eb74217a4c76e1d64c0ec [file] [log] [blame]
Yingdi Yuc972c452013-10-11 11:02:09 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2/*
Varun Patila24bd3e2020-11-24 10:08:33 +05303 * Copyright (c) 2020, Regents of the University of California
Yingdi Yuc972c452013-10-11 11:02:09 -07004 * Yingdi Yu
5 *
6 * BSD license, See the LICENSE file for more information
7 *
8 * Author: Yingdi Yu <yingdi@cs.ucla.edu>
Qiuhan Ding0cfc1512015-02-17 17:44:11 -08009 * Qiuhan Ding <qiuhanding@cs.ucla.edu>
Yingdi Yuc972c452013-10-11 11:02:09 -070010 */
11
Yingdi Yueb692ac2015-02-10 18:46:18 -080012#ifndef CHRONOCHAT_ENDORSE_CERTIFICATE_HPP
13#define CHRONOCHAT_ENDORSE_CERTIFICATE_HPP
Yingdi Yuc972c452013-10-11 11:02:09 -070014
Yingdi Yu0b0a7362014-08-05 16:31:30 -070015#include "profile.hpp"
Yingdi Yuf8f572d2014-01-13 11:19:47 -080016
Yingdi Yueb692ac2015-02-10 18:46:18 -080017namespace chronochat {
Yingdi Yuc972c452013-10-11 11:02:09 -070018
Varun Patil3d850902020-11-23 12:19:14 +053019class EndorseCertificate : public ndn::security::Certificate
Yingdi Yuc972c452013-10-11 11:02:09 -070020{
21public:
Varun Patil3d850902020-11-23 12:19:14 +053022 class Error : public ndn::security::Certificate::Error
Yingdi Yu0b0a7362014-08-05 16:31:30 -070023 {
24 public:
25 Error(const std::string& what)
Varun Patil3d850902020-11-23 12:19:14 +053026 : ndn::security::Certificate::Error(what)
Yingdi Yu0b0a7362014-08-05 16:31:30 -070027 {
28 }
29 };
Yingdi Yuf8f572d2014-01-13 11:19:47 -080030
Yingdi Yu348f5ea2014-03-01 14:47:25 -080031 static const std::vector<std::string> DEFAULT_ENDORSE_LIST;
32
Yingdi Yud95c5642013-10-20 19:43:10 -070033 EndorseCertificate() {}
34
Varun Patil3d850902020-11-23 12:19:14 +053035 EndorseCertificate(const ndn::security::Certificate& kskCertificate,
Yingdi Yufa4ce792014-02-06 18:09:22 -080036 const Profile& profile,
Yingdi Yu348f5ea2014-03-01 14:47:25 -080037 const std::vector<std::string>& endorseList = DEFAULT_ENDORSE_LIST);
Yingdi Yub4be64a2013-10-13 17:24:50 -070038
39 EndorseCertificate(const EndorseCertificate& endorseCertificate,
Yingdi Yu0b0a7362014-08-05 16:31:30 -070040 const Name& signer,
Yingdi Yu348f5ea2014-03-01 14:47:25 -080041 const std::vector<std::string>& endorseList = DEFAULT_ENDORSE_LIST);
42
Yingdi Yu0b0a7362014-08-05 16:31:30 -070043 EndorseCertificate(const Name& keyName,
Varun Patil3d850902020-11-23 12:19:14 +053044 const ndn::Buffer& key,
Yingdi Yu0b0a7362014-08-05 16:31:30 -070045 const time::system_clock::TimePoint& notBefore,
46 const time::system_clock::TimePoint& notAfter,
Varun Patil3d850902020-11-23 12:19:14 +053047 const Name::Component& signerKeyId,
Yingdi Yu0b0a7362014-08-05 16:31:30 -070048 const Name& signer,
Yingdi Yu348f5ea2014-03-01 14:47:25 -080049 const Profile& profile,
50 const std::vector<std::string>& endorseList = DEFAULT_ENDORSE_LIST);
Yingdi Yuc972c452013-10-11 11:02:09 -070051
52 EndorseCertificate(const EndorseCertificate& endorseCertificate);
53
Yingdi Yu0b0a7362014-08-05 16:31:30 -070054 EndorseCertificate(const Data& data);
Yingdi Yuc972c452013-10-11 11:02:09 -070055
56 virtual
57 ~EndorseCertificate()
Yingdi Yu0b0a7362014-08-05 16:31:30 -070058 {
59 }
Yingdi Yuc972c452013-10-11 11:02:09 -070060
Yingdi Yu0b0a7362014-08-05 16:31:30 -070061 const Name&
Yingdi Yuc972c452013-10-11 11:02:09 -070062 getSigner() const
Yingdi Yu0b0a7362014-08-05 16:31:30 -070063 {
64 return m_signer;
65 }
Yingdi Yuc972c452013-10-11 11:02:09 -070066
Yingdi Yufa4ce792014-02-06 18:09:22 -080067 const Profile&
68 getProfile() const
Yingdi Yu0b0a7362014-08-05 16:31:30 -070069 {
70 return m_profile;
71 }
Yingdi Yuc972c452013-10-11 11:02:09 -070072
Yingdi Yu76dd8002013-12-24 11:16:32 +080073 const std::vector<std::string>&
Yingdi Yub4be64a2013-10-13 17:24:50 -070074 getEndorseList() const
Yingdi Yu0b0a7362014-08-05 16:31:30 -070075 {
76 return m_endorseList;
77 }
Yingdi Yub4be64a2013-10-13 17:24:50 -070078
Yingdi Yufa4ce792014-02-06 18:09:22 -080079private:
Varun Patil3d850902020-11-23 12:19:14 +053080 Name m_signer;
Yingdi Yufa4ce792014-02-06 18:09:22 -080081 Profile m_profile;
Yingdi Yub4be64a2013-10-13 17:24:50 -070082 std::vector<std::string> m_endorseList;
Yingdi Yuc972c452013-10-11 11:02:09 -070083};
84
Yingdi Yueb692ac2015-02-10 18:46:18 -080085} // namespace chronochat
Yingdi Yufa4ce792014-02-06 18:09:22 -080086
Yingdi Yueb692ac2015-02-10 18:46:18 -080087#endif // CHRONOCHAT_ENDORSE_CERTIFICATE_HPP