Jeff Thompson | 958bf9b | 2013-10-12 17:20:51 -0700 | [diff] [blame] | 1 | /* -*- 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 | |
| 15 | namespace ndn { |
| 16 | |
| 17 | namespace der { class DerNode; } |
| 18 | |
| 19 | /** |
| 20 | * A CertificateSubjectDescription represents the SubjectDescription entry in a Certificate. |
| 21 | */ |
| 22 | class CertificateSubjectDescription { |
| 23 | public: |
| 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> |
| 49 | toDer(); |
| 50 | |
| 51 | std::string |
| 52 | getOidString() |
| 53 | { |
| 54 | return oid_.toString(); |
| 55 | } |
| 56 | |
| 57 | const std::string & |
| 58 | getValue() const |
| 59 | { |
| 60 | return value_; |
| 61 | } |
| 62 | |
| 63 | private: |
| 64 | OID oid_; |
| 65 | std::string value_; |
| 66 | }; |
| 67 | |
| 68 | } |
| 69 | |
| 70 | #endif |