NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
certificate-extension.cpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
25
#include "
certificate-extension.hpp
"
26
#include "
cryptopp.hpp
"
27
28
namespace
ndn
{
29
namespace
security
{
30
namespace
v1 {
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 v1
76
}
// namespace security
77
}
// namespace ndn
ndn::Oid::encode
void encode(CryptoPP::BufferedTransformation &out) const
Definition:
oid.cpp:118
ndn::Oid::decode
void decode(CryptoPP::BufferedTransformation &in)
Definition:
oid.cpp:135
ndn::security::v1::CertificateExtension::encode
void encode(CryptoPP::BufferedTransformation &out) const
Definition:
certificate-extension.cpp:33
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
CryptoPP
Copyright (c) 2013-2016 Regents of the University of California.
Definition:
oid.hpp:29
ndn::security::v1::CertificateExtension::m_extensionId
Oid m_extensionId
Definition:
certificate-extension.hpp:113
ndn::security::v1::CertificateExtension::m_extensionValue
Buffer m_extensionValue
Definition:
certificate-extension.hpp:115
cryptopp.hpp
ndn::Buffer::buf
uint8_t * buf()
Definition:
buffer.hpp:87
ndn::security::v1::CertificateExtension::m_isCritical
bool m_isCritical
Definition:
certificate-extension.hpp:114
ndn::security::v1::CertificateExtension::decode
void decode(CryptoPP::BufferedTransformation &in)
Definition:
certificate-extension.cpp:52
security
certificate-extension.hpp
ndnSIM
ndn-cxx
src
security
v1
certificate-extension.cpp
Generated on Wed Jan 11 2017 18:17:14 for ndnSIM by
1.8.13