blob: 7352a4ddf201dba14f92882436c120c35dacce7a [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 Yufa4ce792014-02-06 18:09:22 -080011#ifndef CHRONOS_ENDORSE_CERTIFICATE_H
12#define CHRONOS_ENDORSE_CERTIFICATE_H
Yingdi Yuc972c452013-10-11 11:02:09 -070013
Yingdi Yufa4ce792014-02-06 18:09:22 -080014#include "profile.h"
Yingdi Yuc972c452013-10-11 11:02:09 -070015#include <vector>
Yingdi Yub6fb0302014-01-21 11:05:11 -080016#include <ndn-cpp-dev/security/identity-certificate.hpp>
Yingdi Yuc972c452013-10-11 11:02:09 -070017
Yingdi Yuc972c452013-10-11 11:02:09 -070018
Yingdi Yuf8f572d2014-01-13 11:19:47 -080019
Yingdi Yufa4ce792014-02-06 18:09:22 -080020namespace chronos{
Yingdi Yuc972c452013-10-11 11:02:09 -070021
Yingdi Yu76dd8002013-12-24 11:16:32 +080022class EndorseCertificate : public ndn::Certificate
Yingdi Yuc972c452013-10-11 11:02:09 -070023{
24public:
Yingdi Yuf8f572d2014-01-13 11:19:47 -080025 struct Error : public ndn::Certificate::Error { Error(const std::string &what) : ndn::Certificate::Error(what) {} };
26
Yingdi Yud95c5642013-10-20 19:43:10 -070027 EndorseCertificate() {}
28
Yingdi Yu76dd8002013-12-24 11:16:32 +080029 EndorseCertificate(const ndn::IdentityCertificate& kskCertificate,
Yingdi Yufa4ce792014-02-06 18:09:22 -080030 const Profile& profile,
Yingdi Yub2e747d2013-11-05 23:06:43 -080031 const std::vector<std::string>& endorseList = std::vector<std::string>());
Yingdi Yub4be64a2013-10-13 17:24:50 -070032
33 EndorseCertificate(const EndorseCertificate& endorseCertificate,
Yingdi Yuc972c452013-10-11 11:02:09 -070034 const ndn::Name& signer,
Yingdi Yub4be64a2013-10-13 17:24:50 -070035 const std::vector<std::string>& endorseList);
Yingdi Yuc972c452013-10-11 11:02:09 -070036
37 EndorseCertificate(const EndorseCertificate& endorseCertificate);
38
39 EndorseCertificate(const ndn::Data& data);
40
41 virtual
42 ~EndorseCertificate()
43 {}
44
Yingdi Yu76dd8002013-12-24 11:16:32 +080045 const ndn::Name&
Yingdi Yuc972c452013-10-11 11:02:09 -070046 getSigner() const
47 { return m_signer; }
48
Yingdi Yufa4ce792014-02-06 18:09:22 -080049 const Profile&
50 getProfile() const
51 { return m_profile; }
Yingdi Yuc972c452013-10-11 11:02:09 -070052
Yingdi Yu76dd8002013-12-24 11:16:32 +080053 const std::vector<std::string>&
Yingdi Yub4be64a2013-10-13 17:24:50 -070054 getEndorseList() const
55 { return m_endorseList; }
56
Yingdi Yufa4ce792014-02-06 18:09:22 -080057 const ndn::Name&
Yingdi Yub4be64a2013-10-13 17:24:50 -070058 getPublicKeyName () const
Yingdi Yuc972c452013-10-11 11:02:09 -070059 { return m_keyName; }
60
Yingdi Yufa4ce792014-02-06 18:09:22 -080061private:
62 static const ndn::OID PROFILE_EXT_OID;
63 static const ndn::OID ENDORSE_EXT_OID;
64
Yingdi Yuc972c452013-10-11 11:02:09 -070065 ndn::Name m_keyName;
66 ndn::Name m_signer;
Yingdi Yufa4ce792014-02-06 18:09:22 -080067 Profile m_profile;
Yingdi Yub4be64a2013-10-13 17:24:50 -070068 std::vector<std::string> m_endorseList;
Yingdi Yuc972c452013-10-11 11:02:09 -070069};
70
Yingdi Yufa4ce792014-02-06 18:09:22 -080071}//chronos
72
Yingdi Yuc972c452013-10-11 11:02:09 -070073#endif