blob: 30af6bf6480f70529ef05bfe33e87114a5b29d89 [file] [log] [blame]
Jeff Thompson958bf9b2013-10-12 17:20:51 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2/**
3 * Copyright (C) 2013 Regents of the University of California.
4 * @author: Yingdi Yu <yingdi@cs.ucla.edu>
5 * @author: Jeff Thompson <jefft0@remap.ucla.edu>
6 * See COPYING for copyright and distribution information.
7 */
8
9#ifndef NDN_CERTIFICATE_SUBJECT_DESCRIPTION_HPP
10#define NDN_CERTIFICATE_SUBJECT_DESCRIPTION_HPP
11
12#include "../../common.hpp"
13#include "../../encoding/oid.hpp"
14
15namespace ndn {
16
17namespace der { class DerNode; }
18
19/**
20 * A CertificateSubjectDescription represents the SubjectDescription entry in a Certificate.
21 */
22class CertificateSubjectDescription {
23public:
24 /**
25 * Create a new CertificateSubjectDescription.
26 * @param oid The oid of the subject description entry.
27 * @param value The value of the subject description entry.
28 */
29 CertificateSubjectDescription(std::string oid, std::string value)
30 : oid_(oid), value_(value)
31 {
32 }
33
34 /**
35 * Create a new CertificateSubjectDescription.
36 * @param oid The oid of the subject description entry.
37 * @param value The value of the subject description entry.
38 */
39 CertificateSubjectDescription(OID oid, std::string value)
40 : oid_(oid), value_(value)
41 {
42 }
43
44 /**
45 * Encode the object into a DER syntax tree.
46 * @return The encoded DER syntax tree.
47 */
48 ptr_lib::shared_ptr<der::DerNode>
Jeff Thompson61a25ff2013-12-20 10:40:04 -080049 toDer() const;
Jeff Thompson958bf9b2013-10-12 17:20:51 -070050
51 std::string
Jeff Thompson61a25ff2013-12-20 10:40:04 -080052 getOidString() const
Jeff Thompson958bf9b2013-10-12 17:20:51 -070053 {
54 return oid_.toString();
55 }
56
57 const std::string &
58 getValue() const
59 {
60 return value_;
61 }
62
63private:
64 OID oid_;
65 std::string value_;
66};
67
68}
69
70#endif