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> |
| 9 | */ |
| 10 | |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 11 | #ifndef CHRONOS_ENDORSE_CERTIFICATE_H |
| 12 | #define CHRONOS_ENDORSE_CERTIFICATE_H |
Yingdi Yu | c972c45 | 2013-10-11 11:02:09 -0700 | [diff] [blame] | 13 | |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 14 | #include "profile.h" |
Yingdi Yu | c972c45 | 2013-10-11 11:02:09 -0700 | [diff] [blame] | 15 | #include <vector> |
Yingdi Yu | b6fb030 | 2014-01-21 11:05:11 -0800 | [diff] [blame] | 16 | #include <ndn-cpp-dev/security/identity-certificate.hpp> |
Yingdi Yu | c972c45 | 2013-10-11 11:02:09 -0700 | [diff] [blame] | 17 | |
Yingdi Yu | c972c45 | 2013-10-11 11:02:09 -0700 | [diff] [blame] | 18 | |
Yingdi Yu | f8f572d | 2014-01-13 11:19:47 -0800 | [diff] [blame] | 19 | |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 20 | namespace chronos{ |
Yingdi Yu | c972c45 | 2013-10-11 11:02:09 -0700 | [diff] [blame] | 21 | |
Yingdi Yu | 76dd800 | 2013-12-24 11:16:32 +0800 | [diff] [blame] | 22 | class EndorseCertificate : public ndn::Certificate |
Yingdi Yu | c972c45 | 2013-10-11 11:02:09 -0700 | [diff] [blame] | 23 | { |
| 24 | public: |
Yingdi Yu | f8f572d | 2014-01-13 11:19:47 -0800 | [diff] [blame] | 25 | struct Error : public ndn::Certificate::Error { Error(const std::string &what) : ndn::Certificate::Error(what) {} }; |
| 26 | |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame^] | 27 | static const std::vector<std::string> DEFAULT_ENDORSE_LIST; |
| 28 | |
Yingdi Yu | d95c564 | 2013-10-20 19:43:10 -0700 | [diff] [blame] | 29 | EndorseCertificate() {} |
| 30 | |
Yingdi Yu | 76dd800 | 2013-12-24 11:16:32 +0800 | [diff] [blame] | 31 | EndorseCertificate(const ndn::IdentityCertificate& kskCertificate, |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 32 | const Profile& profile, |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame^] | 33 | const std::vector<std::string>& endorseList = DEFAULT_ENDORSE_LIST); |
Yingdi Yu | b4be64a | 2013-10-13 17:24:50 -0700 | [diff] [blame] | 34 | |
| 35 | EndorseCertificate(const EndorseCertificate& endorseCertificate, |
Yingdi Yu | c972c45 | 2013-10-11 11:02:09 -0700 | [diff] [blame] | 36 | const ndn::Name& signer, |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame^] | 37 | const std::vector<std::string>& endorseList = DEFAULT_ENDORSE_LIST); |
| 38 | |
| 39 | EndorseCertificate(const ndn::Name& keyName, |
| 40 | const ndn::PublicKey& key, |
| 41 | ndn::MillisecondsSince1970 notBefore, |
| 42 | ndn::MillisecondsSince1970 notAfter, |
| 43 | const ndn::Name& signer, |
| 44 | const Profile& profile, |
| 45 | const std::vector<std::string>& endorseList = DEFAULT_ENDORSE_LIST); |
Yingdi Yu | c972c45 | 2013-10-11 11:02:09 -0700 | [diff] [blame] | 46 | |
| 47 | EndorseCertificate(const EndorseCertificate& endorseCertificate); |
| 48 | |
| 49 | EndorseCertificate(const ndn::Data& data); |
| 50 | |
| 51 | virtual |
| 52 | ~EndorseCertificate() |
| 53 | {} |
| 54 | |
Yingdi Yu | 76dd800 | 2013-12-24 11:16:32 +0800 | [diff] [blame] | 55 | const ndn::Name& |
Yingdi Yu | c972c45 | 2013-10-11 11:02:09 -0700 | [diff] [blame] | 56 | getSigner() const |
| 57 | { return m_signer; } |
| 58 | |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 59 | const Profile& |
| 60 | getProfile() const |
| 61 | { return m_profile; } |
Yingdi Yu | c972c45 | 2013-10-11 11:02:09 -0700 | [diff] [blame] | 62 | |
Yingdi Yu | 76dd800 | 2013-12-24 11:16:32 +0800 | [diff] [blame] | 63 | const std::vector<std::string>& |
Yingdi Yu | b4be64a | 2013-10-13 17:24:50 -0700 | [diff] [blame] | 64 | getEndorseList() const |
| 65 | { return m_endorseList; } |
| 66 | |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 67 | const ndn::Name& |
Yingdi Yu | b4be64a | 2013-10-13 17:24:50 -0700 | [diff] [blame] | 68 | getPublicKeyName () const |
Yingdi Yu | c972c45 | 2013-10-11 11:02:09 -0700 | [diff] [blame] | 69 | { return m_keyName; } |
| 70 | |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 71 | private: |
| 72 | static const ndn::OID PROFILE_EXT_OID; |
| 73 | static const ndn::OID ENDORSE_EXT_OID; |
| 74 | |
Yingdi Yu | c972c45 | 2013-10-11 11:02:09 -0700 | [diff] [blame] | 75 | ndn::Name m_keyName; |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame^] | 76 | ndn::Name m_signer; // signing key name |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 77 | Profile m_profile; |
Yingdi Yu | b4be64a | 2013-10-13 17:24:50 -0700 | [diff] [blame] | 78 | std::vector<std::string> m_endorseList; |
Yingdi Yu | c972c45 | 2013-10-11 11:02:09 -0700 | [diff] [blame] | 79 | }; |
| 80 | |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 81 | }//chronos |
| 82 | |
Yingdi Yu | c972c45 | 2013-10-11 11:02:09 -0700 | [diff] [blame] | 83 | #endif |