NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
certificate-subject-description.cpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26 #include "common.hpp"
27 
29 
30 #include "cryptopp.hpp"
31 
32 namespace ndn {
33 
34 void
35 CertificateSubjectDescription::encode(CryptoPP::BufferedTransformation& out) const
36 {
37  using namespace CryptoPP;
38  // RelativeDistinguishedName ::=
39  // SET OF AttributeTypeAndValue
40  //
41  // AttributeTypeAndValue ::= SEQUENCE {
42  // type AttributeType,
43  // value AttributeValue }
44  //
45  // AttributeType ::= OBJECT IDENTIFIER
46  //
47  // AttributeValue ::= ANY DEFINED BY AttributeType
48  DERSequenceEncoder attributeTypeAndValue(out);
49  {
50  m_oid.encode(attributeTypeAndValue);
51  DEREncodeTextString(attributeTypeAndValue, m_value, PRINTABLE_STRING);
52  }
53  attributeTypeAndValue.MessageEnd();
54 }
55 
56 void
57 CertificateSubjectDescription::decode(CryptoPP::BufferedTransformation& in)
58 {
59  using namespace CryptoPP;
60  // RelativeDistinguishedName ::=
61  // SET OF AttributeTypeAndValue
62  //
63  // AttributeTypeAndValue ::= SEQUENCE {
64  // type AttributeType,
65  // value AttributeValue }
66  //
67  // AttributeType ::= OBJECT IDENTIFIER
68  //
69  // AttributeValue ::= ANY DEFINED BY AttributeType
70 
71  BERSequenceDecoder attributeTypeAndValue(in);
72  {
73  m_oid.decode(attributeTypeAndValue);
74 
77  BERDecodeTextString(attributeTypeAndValue, m_value, PRINTABLE_STRING);
78  }
79  attributeTypeAndValue.MessageEnd();
80 }
81 
82 } // namespace ndn
Copyright (c) 2011-2015 Regents of the University of California.
Copyright (c) 2013-2014 Regents of the University of California.
Definition: oid.hpp:29
void encode(CryptoPP::BufferedTransformation &out) const
void decode(CryptoPP::BufferedTransformation &in)