blob: 5510f6e5bc07b5ccab734b8578b54a6caaacbc0c [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
Yingdi Yufc40d872014-02-18 12:56:04 -08009#ifndef NDN_SECURITY_CERTIFICATE_SUBJECT_DESCRIPTION_HPP
10#define NDN_SECURITY_CERTIFICATE_SUBJECT_DESCRIPTION_HPP
Jeff Thompson958bf9b2013-10-12 17:20:51 -070011
Yingdi Yu4f324632014-01-15 18:10:03 -080012#include "../common.hpp"
13#include "../encoding/oid.hpp"
Jeff Thompson958bf9b2013-10-12 17:20:51 -070014
Alexander Afanasyev0ea6e082013-12-26 15:16:37 -080015namespace CryptoPP { class BufferedTransformation; }
16
Jeff Thompson958bf9b2013-10-12 17:20:51 -070017namespace ndn {
18
Jeff Thompson958bf9b2013-10-12 17:20:51 -070019/**
20 * A CertificateSubjectDescription represents the SubjectDescription entry in a Certificate.
21 */
22class CertificateSubjectDescription {
23public:
Alexander Afanasyev0ea6e082013-12-26 15:16:37 -080024 CertificateSubjectDescription(CryptoPP::BufferedTransformation &in)
Jeff Thompson958bf9b2013-10-12 17:20:51 -070025 {
Alexander Afanasyev0ea6e082013-12-26 15:16:37 -080026 decode(in);
Jeff Thompson958bf9b2013-10-12 17:20:51 -070027 }
28
29 /**
Alexander Afanasyev0ea6e082013-12-26 15:16:37 -080030 * Create a new CertificateSubjectDescription.
31 * @param oid The oid of the subject description entry.
32 * @param value The value of the subject description entry.
Jeff Thompson958bf9b2013-10-12 17:20:51 -070033 */
Alexander Afanasyev0ea6e082013-12-26 15:16:37 -080034 CertificateSubjectDescription(const OID &oid, const std::string &value)
35 : oid_(oid), value_(value)
36 {
37 }
38
39 void
40 encode(CryptoPP::BufferedTransformation &out) const;
41
42 void
43 decode(CryptoPP::BufferedTransformation &in);
44
Jeff Thompson958bf9b2013-10-12 17:20:51 -070045 std::string
Jeff Thompson61a25ff2013-12-20 10:40:04 -080046 getOidString() const
Jeff Thompson958bf9b2013-10-12 17:20:51 -070047 {
48 return oid_.toString();
49 }
50
51 const std::string &
52 getValue() const
53 {
54 return value_;
55 }
56
57private:
58 OID oid_;
59 std::string value_;
60};
61
Yingdi Yufc40d872014-02-18 12:56:04 -080062} // namespace ndn
Jeff Thompson958bf9b2013-10-12 17:20:51 -070063
Yingdi Yufc40d872014-02-18 12:56:04 -080064#endif //NDN_SECURITY_CERTIFICATE_SUBJECT_DESCRIPTION_HPP