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 | d95c564 | 2013-10-20 19:43:10 -0700 | [diff] [blame] | 27 | EndorseCertificate() {} |
| 28 | |
Yingdi Yu | 76dd800 | 2013-12-24 11:16:32 +0800 | [diff] [blame] | 29 | EndorseCertificate(const ndn::IdentityCertificate& kskCertificate, |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 30 | const Profile& profile, |
Yingdi Yu | b2e747d | 2013-11-05 23:06:43 -0800 | [diff] [blame] | 31 | const std::vector<std::string>& endorseList = std::vector<std::string>()); |
Yingdi Yu | b4be64a | 2013-10-13 17:24:50 -0700 | [diff] [blame] | 32 | |
| 33 | EndorseCertificate(const EndorseCertificate& endorseCertificate, |
Yingdi Yu | c972c45 | 2013-10-11 11:02:09 -0700 | [diff] [blame] | 34 | const ndn::Name& signer, |
Yingdi Yu | b4be64a | 2013-10-13 17:24:50 -0700 | [diff] [blame] | 35 | const std::vector<std::string>& endorseList); |
Yingdi Yu | c972c45 | 2013-10-11 11:02:09 -0700 | [diff] [blame] | 36 | |
| 37 | EndorseCertificate(const EndorseCertificate& endorseCertificate); |
| 38 | |
| 39 | EndorseCertificate(const ndn::Data& data); |
| 40 | |
| 41 | virtual |
| 42 | ~EndorseCertificate() |
| 43 | {} |
| 44 | |
Yingdi Yu | 76dd800 | 2013-12-24 11:16:32 +0800 | [diff] [blame] | 45 | const ndn::Name& |
Yingdi Yu | c972c45 | 2013-10-11 11:02:09 -0700 | [diff] [blame] | 46 | getSigner() const |
| 47 | { return m_signer; } |
| 48 | |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 49 | const Profile& |
| 50 | getProfile() const |
| 51 | { return m_profile; } |
Yingdi Yu | c972c45 | 2013-10-11 11:02:09 -0700 | [diff] [blame] | 52 | |
Yingdi Yu | 76dd800 | 2013-12-24 11:16:32 +0800 | [diff] [blame] | 53 | const std::vector<std::string>& |
Yingdi Yu | b4be64a | 2013-10-13 17:24:50 -0700 | [diff] [blame] | 54 | getEndorseList() const |
| 55 | { return m_endorseList; } |
| 56 | |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 57 | const ndn::Name& |
Yingdi Yu | b4be64a | 2013-10-13 17:24:50 -0700 | [diff] [blame] | 58 | getPublicKeyName () const |
Yingdi Yu | c972c45 | 2013-10-11 11:02:09 -0700 | [diff] [blame] | 59 | { return m_keyName; } |
| 60 | |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 61 | private: |
| 62 | static const ndn::OID PROFILE_EXT_OID; |
| 63 | static const ndn::OID ENDORSE_EXT_OID; |
| 64 | |
Yingdi Yu | c972c45 | 2013-10-11 11:02:09 -0700 | [diff] [blame] | 65 | ndn::Name m_keyName; |
| 66 | ndn::Name m_signer; |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 67 | Profile m_profile; |
Yingdi Yu | b4be64a | 2013-10-13 17:24:50 -0700 | [diff] [blame] | 68 | std::vector<std::string> m_endorseList; |
Yingdi Yu | c972c45 | 2013-10-11 11:02:09 -0700 | [diff] [blame] | 69 | }; |
| 70 | |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 71 | }//chronos |
| 72 | |
Yingdi Yu | c972c45 | 2013-10-11 11:02:09 -0700 | [diff] [blame] | 73 | #endif |