Yingdi Yu | c972c45 | 2013-10-11 11:02:09 -0700 | [diff] [blame] | 1 | /* -*- 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> |
Qiuhan Ding | 0cfc151 | 2015-02-17 17:44:11 -0800 | [diff] [blame] | 9 | * Qiuhan Ding <qiuhanding@cs.ucla.edu> |
Yingdi Yu | c972c45 | 2013-10-11 11:02:09 -0700 | [diff] [blame] | 10 | */ |
| 11 | |
Yingdi Yu | eb692ac | 2015-02-10 18:46:18 -0800 | [diff] [blame] | 12 | #ifndef CHRONOCHAT_ENDORSE_CERTIFICATE_HPP |
| 13 | #define CHRONOCHAT_ENDORSE_CERTIFICATE_HPP |
Yingdi Yu | c972c45 | 2013-10-11 11:02:09 -0700 | [diff] [blame] | 14 | |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 15 | #include "profile.hpp" |
Yingdi Yu | f8f572d | 2014-01-13 11:19:47 -0800 | [diff] [blame] | 16 | |
Yingdi Yu | eb692ac | 2015-02-10 18:46:18 -0800 | [diff] [blame] | 17 | namespace chronochat { |
Yingdi Yu | c972c45 | 2013-10-11 11:02:09 -0700 | [diff] [blame] | 18 | |
Yingdi Yu | 76dd800 | 2013-12-24 11:16:32 +0800 | [diff] [blame] | 19 | class EndorseCertificate : public ndn::Certificate |
Yingdi Yu | c972c45 | 2013-10-11 11:02:09 -0700 | [diff] [blame] | 20 | { |
| 21 | public: |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 22 | class Error : public ndn::Certificate::Error |
| 23 | { |
| 24 | public: |
| 25 | Error(const std::string& what) |
| 26 | : ndn::Certificate::Error(what) |
| 27 | { |
| 28 | } |
| 29 | }; |
Yingdi Yu | f8f572d | 2014-01-13 11:19:47 -0800 | [diff] [blame] | 30 | |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 31 | static const std::vector<std::string> DEFAULT_ENDORSE_LIST; |
| 32 | |
Yingdi Yu | d95c564 | 2013-10-20 19:43:10 -0700 | [diff] [blame] | 33 | EndorseCertificate() {} |
| 34 | |
Yingdi Yu | 76dd800 | 2013-12-24 11:16:32 +0800 | [diff] [blame] | 35 | EndorseCertificate(const ndn::IdentityCertificate& kskCertificate, |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 36 | const Profile& profile, |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 37 | const std::vector<std::string>& endorseList = DEFAULT_ENDORSE_LIST); |
Yingdi Yu | b4be64a | 2013-10-13 17:24:50 -0700 | [diff] [blame] | 38 | |
| 39 | EndorseCertificate(const EndorseCertificate& endorseCertificate, |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 40 | const Name& signer, |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 41 | const std::vector<std::string>& endorseList = DEFAULT_ENDORSE_LIST); |
| 42 | |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 43 | EndorseCertificate(const Name& keyName, |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 44 | const ndn::PublicKey& key, |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 45 | const time::system_clock::TimePoint& notBefore, |
| 46 | const time::system_clock::TimePoint& notAfter, |
| 47 | const Name& signer, |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 48 | const Profile& profile, |
| 49 | const std::vector<std::string>& endorseList = DEFAULT_ENDORSE_LIST); |
Yingdi Yu | c972c45 | 2013-10-11 11:02:09 -0700 | [diff] [blame] | 50 | |
| 51 | EndorseCertificate(const EndorseCertificate& endorseCertificate); |
| 52 | |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 53 | EndorseCertificate(const Data& data); |
Yingdi Yu | c972c45 | 2013-10-11 11:02:09 -0700 | [diff] [blame] | 54 | |
| 55 | virtual |
| 56 | ~EndorseCertificate() |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 57 | { |
| 58 | } |
Yingdi Yu | c972c45 | 2013-10-11 11:02:09 -0700 | [diff] [blame] | 59 | |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 60 | const Name& |
Yingdi Yu | c972c45 | 2013-10-11 11:02:09 -0700 | [diff] [blame] | 61 | getSigner() const |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 62 | { |
| 63 | return m_signer; |
| 64 | } |
Yingdi Yu | c972c45 | 2013-10-11 11:02:09 -0700 | [diff] [blame] | 65 | |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 66 | const Profile& |
| 67 | getProfile() const |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 68 | { |
| 69 | return m_profile; |
| 70 | } |
Yingdi Yu | c972c45 | 2013-10-11 11:02:09 -0700 | [diff] [blame] | 71 | |
Yingdi Yu | 76dd800 | 2013-12-24 11:16:32 +0800 | [diff] [blame] | 72 | const std::vector<std::string>& |
Yingdi Yu | b4be64a | 2013-10-13 17:24:50 -0700 | [diff] [blame] | 73 | getEndorseList() const |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 74 | { |
| 75 | return m_endorseList; |
| 76 | } |
Yingdi Yu | b4be64a | 2013-10-13 17:24:50 -0700 | [diff] [blame] | 77 | |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 78 | const Name& |
Yingdi Yu | b4be64a | 2013-10-13 17:24:50 -0700 | [diff] [blame] | 79 | getPublicKeyName () const |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 80 | { |
| 81 | return m_keyName; |
| 82 | } |
Yingdi Yu | c972c45 | 2013-10-11 11:02:09 -0700 | [diff] [blame] | 83 | |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 84 | private: |
| 85 | static const ndn::OID PROFILE_EXT_OID; |
| 86 | static const ndn::OID ENDORSE_EXT_OID; |
| 87 | |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 88 | Name m_keyName; |
| 89 | Name m_signer; // signing key name |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 90 | Profile m_profile; |
Yingdi Yu | b4be64a | 2013-10-13 17:24:50 -0700 | [diff] [blame] | 91 | std::vector<std::string> m_endorseList; |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 92 | |
Yingdi Yu | c972c45 | 2013-10-11 11:02:09 -0700 | [diff] [blame] | 93 | }; |
| 94 | |
Yingdi Yu | eb692ac | 2015-02-10 18:46:18 -0800 | [diff] [blame] | 95 | } // namespace chronochat |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 96 | |
Yingdi Yu | eb692ac | 2015-02-10 18:46:18 -0800 | [diff] [blame] | 97 | #endif // CHRONOCHAT_ENDORSE_CERTIFICATE_HPP |