NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
certificate-extension.cpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
25
#include "common.hpp"
26
27
#include "
certificate-extension.hpp
"
28
#include "
cryptopp.hpp
"
29
30
namespace
ndn
{
31
32
void
33
CertificateExtension::encode
(CryptoPP::BufferedTransformation& out)
const
34
{
35
using namespace
CryptoPP
;
36
37
// Extension ::= SEQUENCE {
38
// extnID OBJECT IDENTIFIER,
39
// critical BOOLEAN DEFAULT FALSE,
40
// extnValue OCTET STRING }
41
42
DERSequenceEncoder extension(out);
43
{
44
m_extensionId
.
encode
(extension);
45
DEREncodeUnsigned(extension,
m_isCritical
, BOOLEAN);
46
DEREncodeOctetString(extension,
m_extensionValue
.
buf
(),
m_extensionValue
.size());
47
}
48
extension.MessageEnd();
49
}
50
51
void
52
CertificateExtension::decode
(CryptoPP::BufferedTransformation& in)
53
{
54
using namespace
CryptoPP
;
55
56
// Extension ::= SEQUENCE {
57
// extnID OBJECT IDENTIFIER,
58
// critical BOOLEAN DEFAULT FALSE,
59
// extnValue OCTET STRING }
60
61
BERSequenceDecoder extension(in);
62
{
63
m_extensionId
.
decode
(extension);
64
BERDecodeUnsigned(extension,
m_isCritical
, BOOLEAN);
65
66
// the extra copy operation can be optimized, but not trivial,
67
// since the length is not known in advance
68
SecByteBlock tmpBlock;
69
BERDecodeOctetString(extension, tmpBlock);
70
m_extensionValue
.assign(tmpBlock.begin(), tmpBlock.end());
71
}
72
extension.MessageEnd();
73
}
74
75
}
// namespace ndn
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
CryptoPP
Copyright (c) 2013-2014 Regents of the University of California.
Definition:
oid.hpp:29
ndn::CertificateExtension::decode
void decode(CryptoPP::BufferedTransformation &in)
Definition:
certificate-extension.cpp:52
ndn::CertificateExtension::m_extensionValue
Buffer m_extensionValue
Definition:
certificate-extension.hpp:113
ndn::OID::decode
void decode(CryptoPP::BufferedTransformation &in)
Definition:
oid.cpp:147
cryptopp.hpp
ndn::Buffer::buf
uint8_t * buf()
Definition:
buffer.hpp:87
ndn::CertificateExtension::m_isCritical
bool m_isCritical
Definition:
certificate-extension.hpp:112
ndn::CertificateExtension::m_extensionId
OID m_extensionId
Definition:
certificate-extension.hpp:111
ndn::CertificateExtension::encode
void encode(CryptoPP::BufferedTransformation &out) const
Definition:
certificate-extension.cpp:33
ndn::OID::encode
void encode(CryptoPP::BufferedTransformation &out) const
Definition:
oid.cpp:130
certificate-extension.hpp
ndnSIM
ndn-cxx
src
security
certificate-extension.cpp
Generated on Tue Feb 23 2016 22:18:43 for ndnSIM by
1.8.11