blob: 4d3a9db671fa795d7c0dc6fddfba5dfc490809d8 [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 Thompson04e2cd62013-11-20 19:11:27 -080026 // Note: The copy constructor works because publicKeyName_ has a copy constructor.
27
Jeff Thompsonc69163b2013-10-12 13:49:50 -070028 /**
29 * Create an IdentityCertificate from the content in the data packet.
30 * @param data The data packet with the content to decode.
31 */
32 IdentityCertificate(const Data& data);
Jeff Thompson965569b2013-10-12 17:52:52 -070033
34 /**
Jeff Thompsona4aa4ce2013-11-21 10:56:24 -080035 * The copy constructor.
36 */
37 IdentityCertificate(const IdentityCertificate& identityCertificate);
38
39 /**
Jeff Thompson965569b2013-10-12 17:52:52 -070040 * The virtual destructor.
41 */
42 virtual
43 ~IdentityCertificate();
Jeff Thompson173fd432013-10-12 18:16:41 -070044
Jeff Thompson6d591972013-10-17 11:16:32 -070045 /**
46 * Override the base class method to check that the name is a valid identity certificate name.
47 * @param name The identity certificate name which is copied.
48 * @return This Data so that you can chain calls to update values.
49 */
50 virtual Data &
Jeff Thompson173fd432013-10-12 18:16:41 -070051 setName(const Name& name);
Jeff Thompson965569b2013-10-12 17:52:52 -070052
Jeff Thompson43a57b12013-10-22 16:25:38 -070053 Name
54 getPublicKeyName () const { return publicKeyName_; }
Jeff Thompson965569b2013-10-12 17:52:52 -070055
56 static bool
57 isIdentityCertificate(const Certificate& certificate);
58
Jeff Thompson74942612013-10-24 16:42:32 -070059 /**
60 * Get the public key name from the full certificate name.
61 * @param certificateName The full certificate name.
62 * @return The related public key name.
63 */
64 static Name
65 certificateNameToPublicKeyName(const Name& certificateName);
66
Jeff Thompson965569b2013-10-12 17:52:52 -070067private:
68 static bool
69 isCorrectName(const Name& name);
Jeff Thompson43a57b12013-10-22 16:25:38 -070070
71 void
72 setPublicKeyName();
73
74protected:
75 Name publicKeyName_;
Jeff Thompsoncf0fdd92013-10-12 11:54:35 -070076};
77
78}
79
80#endif