blob: d111acc064b631067755c069bc7b499ede872c50 [file] [log] [blame]
Jeff Thompsoncf0fdd92013-10-12 11:54:35 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2/**
3 * Copyright (C) 2013 Regents of the University of California.
Jeff Thompsonc69163b2013-10-12 13:49:50 -07004 * @author: Yingdi Yu <yingdi@cs.ucla.edu>
Jeff Thompsoncf0fdd92013-10-12 11:54:35 -07005 * @author: Jeff Thompson <jefft0@remap.ucla.edu>
6 * See COPYING for copyright and distribution information.
7 */
8
9#ifndef NDN_IDENTITY_CERTIFICATE_HPP
Jeff Thompsone589c3f2013-10-12 17:30:50 -070010#define NDN_IDENTITY_CERTIFICATE_HPP
Jeff Thompsoncf0fdd92013-10-12 11:54:35 -070011
12#include "certificate.hpp"
13
14namespace ndn {
15
16class IdentityCertificate : public Certificate
17{
Jeff Thompsonc69163b2013-10-12 13:49:50 -070018public:
19 /**
20 * The default constructor.
21 */
Jeff Thompson173fd432013-10-12 18:16:41 -070022 IdentityCertificate()
23 {
24 }
Jeff Thompsoncf0fdd92013-10-12 11:54:35 -070025
Jeff Thompsonc69163b2013-10-12 13:49:50 -070026 /**
27 * Create an IdentityCertificate from the content in the data packet.
28 * @param data The data packet with the content to decode.
29 */
30 IdentityCertificate(const Data& data);
Jeff Thompson965569b2013-10-12 17:52:52 -070031
32 /**
33 * The virtual destructor.
34 */
35 virtual
36 ~IdentityCertificate();
Jeff Thompson173fd432013-10-12 18:16:41 -070037
Jeff Thompson6d591972013-10-17 11:16:32 -070038 /**
39 * Override the base class method to check that the name is a valid identity certificate name.
40 * @param name The identity certificate name which is copied.
41 * @return This Data so that you can chain calls to update values.
42 */
43 virtual Data &
Jeff Thompson173fd432013-10-12 18:16:41 -070044 setName(const Name& name);
Jeff Thompson965569b2013-10-12 17:52:52 -070045
Jeff Thompson43a57b12013-10-22 16:25:38 -070046 Name
47 getPublicKeyName () const { return publicKeyName_; }
Jeff Thompson965569b2013-10-12 17:52:52 -070048
49 static bool
50 isIdentityCertificate(const Certificate& certificate);
51
52private:
53 static bool
54 isCorrectName(const Name& name);
Jeff Thompson43a57b12013-10-22 16:25:38 -070055
56 void
57 setPublicKeyName();
58
59protected:
60 Name publicKeyName_;
Jeff Thompsoncf0fdd92013-10-12 11:54:35 -070061};
62
63}
64
65#endif