certificate-subject-description.cpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
27 
28 #include "cryptopp.hpp"
29 
30 namespace ndn {
31 namespace security {
32 namespace v1 {
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 v1
83 } // namespace security
84 } // namespace ndn
Copyright (c) 2013-2017 Regents of the University of California.
Definition: common.hpp:75
Copyright (c) 2013-2017 Regents of the University of California.
Definition: oid.hpp:29
void encode(CryptoPP::BufferedTransformation &out) const