blob: 42f255f011126d9dbf1a72cf3ce595a098a6eb7c [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 Yu348f5ea2014-03-01 14:47:25 -080027 static const std::vector<std::string> DEFAULT_ENDORSE_LIST;
28
Yingdi Yud95c5642013-10-20 19:43:10 -070029 EndorseCertificate() {}
30
Yingdi Yu76dd8002013-12-24 11:16:32 +080031 EndorseCertificate(const ndn::IdentityCertificate& kskCertificate,
Yingdi Yufa4ce792014-02-06 18:09:22 -080032 const Profile& profile,
Yingdi Yu348f5ea2014-03-01 14:47:25 -080033 const std::vector<std::string>& endorseList = DEFAULT_ENDORSE_LIST);
Yingdi Yub4be64a2013-10-13 17:24:50 -070034
35 EndorseCertificate(const EndorseCertificate& endorseCertificate,
Yingdi Yuc972c452013-10-11 11:02:09 -070036 const ndn::Name& signer,
Yingdi Yu348f5ea2014-03-01 14:47:25 -080037 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 Yuc972c452013-10-11 11:02:09 -070046
47 EndorseCertificate(const EndorseCertificate& endorseCertificate);
48
49 EndorseCertificate(const ndn::Data& data);
50
51 virtual
52 ~EndorseCertificate()
53 {}
54
Yingdi Yu76dd8002013-12-24 11:16:32 +080055 const ndn::Name&
Yingdi Yuc972c452013-10-11 11:02:09 -070056 getSigner() const
57 { return m_signer; }
58
Yingdi Yufa4ce792014-02-06 18:09:22 -080059 const Profile&
60 getProfile() const
61 { return m_profile; }
Yingdi Yuc972c452013-10-11 11:02:09 -070062
Yingdi Yu76dd8002013-12-24 11:16:32 +080063 const std::vector<std::string>&
Yingdi Yub4be64a2013-10-13 17:24:50 -070064 getEndorseList() const
65 { return m_endorseList; }
66
Yingdi Yufa4ce792014-02-06 18:09:22 -080067 const ndn::Name&
Yingdi Yub4be64a2013-10-13 17:24:50 -070068 getPublicKeyName () const
Yingdi Yuc972c452013-10-11 11:02:09 -070069 { return m_keyName; }
70
Yingdi Yufa4ce792014-02-06 18:09:22 -080071private:
72 static const ndn::OID PROFILE_EXT_OID;
73 static const ndn::OID ENDORSE_EXT_OID;
74
Yingdi Yuc972c452013-10-11 11:02:09 -070075 ndn::Name m_keyName;
Yingdi Yu348f5ea2014-03-01 14:47:25 -080076 ndn::Name m_signer; // signing key name
Yingdi Yufa4ce792014-02-06 18:09:22 -080077 Profile m_profile;
Yingdi Yub4be64a2013-10-13 17:24:50 -070078 std::vector<std::string> m_endorseList;
Yingdi Yuc972c452013-10-11 11:02:09 -070079};
80
Yingdi Yufa4ce792014-02-06 18:09:22 -080081}//chronos
82
Yingdi Yuc972c452013-10-11 11:02:09 -070083#endif