blob: d215a2290cf489788ceab1a02d8b09172304a6ad [file] [log] [blame]
Yingdi Yuc972c452013-10-11 11:02:09 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2/*
3 * Copyright (c) 2013, Regents of the University of California
4 * Yingdi Yu
5 *
6 * BSD license, See the LICENSE file for more information
7 *
8 * Author: Yingdi Yu <yingdi@cs.ucla.edu>
9 */
10
Yingdi Yueb692ac2015-02-10 18:46:18 -080011#ifndef CHRONOCHAT_ENDORSE_CERTIFICATE_HPP
12#define CHRONOCHAT_ENDORSE_CERTIFICATE_HPP
Yingdi Yuc972c452013-10-11 11:02:09 -070013
Yingdi Yu0b0a7362014-08-05 16:31:30 -070014#include "profile.hpp"
Yingdi Yuf8f572d2014-01-13 11:19:47 -080015
Yingdi Yueb692ac2015-02-10 18:46:18 -080016namespace chronochat {
Yingdi Yuc972c452013-10-11 11:02:09 -070017
Yingdi Yu76dd8002013-12-24 11:16:32 +080018class EndorseCertificate : public ndn::Certificate
Yingdi Yuc972c452013-10-11 11:02:09 -070019{
20public:
Yingdi Yu0b0a7362014-08-05 16:31:30 -070021 class Error : public ndn::Certificate::Error
22 {
23 public:
24 Error(const std::string& what)
25 : ndn::Certificate::Error(what)
26 {
27 }
28 };
Yingdi Yuf8f572d2014-01-13 11:19:47 -080029
Yingdi Yu348f5ea2014-03-01 14:47:25 -080030 static const std::vector<std::string> DEFAULT_ENDORSE_LIST;
31
Yingdi Yud95c5642013-10-20 19:43:10 -070032 EndorseCertificate() {}
33
Yingdi Yu76dd8002013-12-24 11:16:32 +080034 EndorseCertificate(const ndn::IdentityCertificate& kskCertificate,
Yingdi Yufa4ce792014-02-06 18:09:22 -080035 const Profile& profile,
Yingdi Yu348f5ea2014-03-01 14:47:25 -080036 const std::vector<std::string>& endorseList = DEFAULT_ENDORSE_LIST);
Yingdi Yub4be64a2013-10-13 17:24:50 -070037
38 EndorseCertificate(const EndorseCertificate& endorseCertificate,
Yingdi Yu0b0a7362014-08-05 16:31:30 -070039 const Name& signer,
Yingdi Yu348f5ea2014-03-01 14:47:25 -080040 const std::vector<std::string>& endorseList = DEFAULT_ENDORSE_LIST);
41
Yingdi Yu0b0a7362014-08-05 16:31:30 -070042 EndorseCertificate(const Name& keyName,
Yingdi Yu348f5ea2014-03-01 14:47:25 -080043 const ndn::PublicKey& key,
Yingdi Yu0b0a7362014-08-05 16:31:30 -070044 const time::system_clock::TimePoint& notBefore,
45 const time::system_clock::TimePoint& notAfter,
46 const Name& signer,
Yingdi Yu348f5ea2014-03-01 14:47:25 -080047 const Profile& profile,
48 const std::vector<std::string>& endorseList = DEFAULT_ENDORSE_LIST);
Yingdi Yuc972c452013-10-11 11:02:09 -070049
50 EndorseCertificate(const EndorseCertificate& endorseCertificate);
51
Yingdi Yu0b0a7362014-08-05 16:31:30 -070052 EndorseCertificate(const Data& data);
Yingdi Yuc972c452013-10-11 11:02:09 -070053
54 virtual
55 ~EndorseCertificate()
Yingdi Yu0b0a7362014-08-05 16:31:30 -070056 {
57 }
Yingdi Yuc972c452013-10-11 11:02:09 -070058
Yingdi Yu0b0a7362014-08-05 16:31:30 -070059 const Name&
Yingdi Yuc972c452013-10-11 11:02:09 -070060 getSigner() const
Yingdi Yu0b0a7362014-08-05 16:31:30 -070061 {
62 return m_signer;
63 }
Yingdi Yuc972c452013-10-11 11:02:09 -070064
Yingdi Yufa4ce792014-02-06 18:09:22 -080065 const Profile&
66 getProfile() const
Yingdi Yu0b0a7362014-08-05 16:31:30 -070067 {
68 return m_profile;
69 }
Yingdi Yuc972c452013-10-11 11:02:09 -070070
Yingdi Yu76dd8002013-12-24 11:16:32 +080071 const std::vector<std::string>&
Yingdi Yub4be64a2013-10-13 17:24:50 -070072 getEndorseList() const
Yingdi Yu0b0a7362014-08-05 16:31:30 -070073 {
74 return m_endorseList;
75 }
Yingdi Yub4be64a2013-10-13 17:24:50 -070076
Yingdi Yu0b0a7362014-08-05 16:31:30 -070077 const Name&
Yingdi Yub4be64a2013-10-13 17:24:50 -070078 getPublicKeyName () const
Yingdi Yu0b0a7362014-08-05 16:31:30 -070079 {
80 return m_keyName;
81 }
Yingdi Yuc972c452013-10-11 11:02:09 -070082
Yingdi Yufa4ce792014-02-06 18:09:22 -080083private:
84 static const ndn::OID PROFILE_EXT_OID;
85 static const ndn::OID ENDORSE_EXT_OID;
86
Yingdi Yu0b0a7362014-08-05 16:31:30 -070087 Name m_keyName;
88 Name m_signer; // signing key name
Yingdi Yufa4ce792014-02-06 18:09:22 -080089 Profile m_profile;
Yingdi Yub4be64a2013-10-13 17:24:50 -070090 std::vector<std::string> m_endorseList;
Yingdi Yu0b0a7362014-08-05 16:31:30 -070091
Yingdi Yuc972c452013-10-11 11:02:09 -070092};
93
Yingdi Yueb692ac2015-02-10 18:46:18 -080094} // namespace chronochat
Yingdi Yufa4ce792014-02-06 18:09:22 -080095
Yingdi Yueb692ac2015-02-10 18:46:18 -080096#endif // CHRONOCHAT_ENDORSE_CERTIFICATE_HPP