NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
security-common.cpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2013-2017 Regents of the University of California.
4
*
5
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
6
*
7
* ndn-cxx library is free software: you can redistribute it and/or modify it under the
8
* terms of the GNU Lesser General Public License as published by the Free Software
9
* Foundation, either version 3 of the License, or (at your option) any later version.
10
*
11
* ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
12
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
14
*
15
* You should have received copies of the GNU General Public License and GNU Lesser
16
* General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
17
* <http://www.gnu.org/licenses/>.
18
*
19
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
20
*/
21
22
#include "
security-common.hpp
"
23
24
#include <ostream>
25
26
namespace
ndn
{
27
28
std::ostream&
29
operator<<
(std::ostream& os,
KeyIdType
keyIdType)
30
{
31
switch
(keyIdType) {
32
case
KeyIdType::USER_SPECIFIED
:
33
return
os <<
"USER_SPECIFIED"
;
34
case
KeyIdType::SHA256
:
35
return
os <<
"SHA256"
;
36
case
KeyIdType::RANDOM
:
37
return
os <<
"RANDOM"
;
38
}
39
return
os << static_cast<int>(keyIdType);
40
}
41
42
std::ostream&
43
operator<<
(std::ostream& os,
KeyType
keyType)
44
{
45
switch
(keyType) {
46
case
KeyType::NONE
:
47
return
os <<
"NONE"
;
48
case
KeyType::RSA
:
49
return
os <<
"RSA"
;
50
case
KeyType::EC
:
51
return
os <<
"EC"
;
52
case
KeyType::AES
:
53
return
os <<
"AES"
;
54
}
55
return
os << static_cast<int>(keyType);
56
}
57
58
std::ostream&
59
operator<<
(std::ostream& os,
KeyClass
keyClass)
60
{
61
switch
(keyClass) {
62
case
KeyClass::NONE
:
63
return
os <<
"NONE"
;
64
case
KeyClass::PUBLIC
:
65
return
os <<
"PUBLIC"
;
66
case
KeyClass::PRIVATE
:
67
return
os <<
"PRIVATE"
;
68
case
KeyClass::SYMMETRIC
:
69
return
os <<
"SYMMETRIC"
;
70
}
71
return
os << static_cast<int>(keyClass);
72
}
73
74
std::ostream&
75
operator<<
(std::ostream& os,
DigestAlgorithm
algorithm)
76
{
77
switch
(algorithm) {
78
case
DigestAlgorithm::NONE
:
79
return
os <<
"NONE"
;
80
case
DigestAlgorithm::SHA224
:
81
return
os <<
"SHA224"
;
82
case
DigestAlgorithm::SHA256
:
83
return
os <<
"SHA256"
;
84
case
DigestAlgorithm::SHA384
:
85
return
os <<
"SHA384"
;
86
case
DigestAlgorithm::SHA512
:
87
return
os <<
"SHA512"
;
88
case
DigestAlgorithm::BLAKE2B_512
:
89
return
os <<
"BLAKE2b-512"
;
90
case
DigestAlgorithm::BLAKE2S_256
:
91
return
os <<
"BLAKE2s-256"
;
92
}
93
return
os << static_cast<int>(algorithm);
94
}
95
96
std::ostream&
97
operator<<
(std::ostream& os,
BlockCipherAlgorithm
algorithm)
98
{
99
switch
(algorithm) {
100
case
BlockCipherAlgorithm::NONE
:
101
return
os <<
"NONE"
;
102
case
BlockCipherAlgorithm::AES_CBC
:
103
return
os <<
"AES_CBC"
;
104
}
105
return
os << static_cast<int>(algorithm);
106
}
107
108
std::ostream&
109
operator<<
(std::ostream& os,
CipherOperator
op)
110
{
111
switch
(op) {
112
case
CipherOperator::DECRYPT
:
113
return
os <<
"DECRYPT"
;
114
case
CipherOperator::ENCRYPT
:
115
return
os <<
"ENCRYPT"
;
116
}
117
return
os << static_cast<int>(op);
118
}
119
120
std::ostream&
121
operator<<
(std::ostream& os,
AclType
aclType)
122
{
123
switch
(aclType) {
124
case
AclType::NONE
:
125
return
os <<
"NONE"
;
126
case
AclType::PUBLIC
:
127
return
os <<
"PUBLIC"
;
128
case
AclType::PRIVATE
:
129
return
os <<
"PRIVATE"
;
130
}
131
return
os << static_cast<int>(aclType);
132
}
133
134
}
// namespace ndn
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
ndn::KeyClass::SYMMETRIC
ndn::KeyType::NONE
Unknown key type.
ndn::DigestAlgorithm::SHA224
ndn::KeyIdType
KeyIdType
The type of KeyId component in a key name.
Definition:
security-common.hpp:58
ndn::BlockCipherAlgorithm
BlockCipherAlgorithm
Definition:
security-common.hpp:118
ndn::operator<<
std::ostream & operator<<(std::ostream &os, const Data &data)
Definition:
data.cpp:274
ndn::CipherOperator
CipherOperator
Definition:
security-common.hpp:126
ndn::KeyType::RSA
RSA key, supports sign/verify and encrypt/decrypt operations.
ndn::KeyClass::NONE
ndn::KeyClass::PUBLIC
ndn::BlockCipherAlgorithm::NONE
ndn::KeyType
KeyType
The type of a cryptographic key.
Definition:
security-common.hpp:85
ndn::AclType::NONE
ndn::CipherOperator::DECRYPT
ndn::AclType
AclType
Definition:
security-common.hpp:134
ndn::KeyType::EC
Elliptic Curve key (e.g. for ECDSA), supports sign/verify operations.
ndn::KeyIdType::SHA256
Use the SHA256 hash of the public key as the key id.
ndn::DigestAlgorithm::SHA512
ndn::DigestAlgorithm::SHA384
ndn::BlockCipherAlgorithm::AES_CBC
ndn::KeyClass
KeyClass
Definition:
security-common.hpp:95
ndn::DigestAlgorithm::BLAKE2S_256
ndn::KeyIdType::RANDOM
Use a 64-bit random number as the key id.
ndn::CipherOperator::ENCRYPT
ndn::KeyIdType::USER_SPECIFIED
User-specified key ID.
ndn::DigestAlgorithm::NONE
ndn::KeyType::AES
AES key, supports encrypt/decrypt operations.
ndn::DigestAlgorithm
DigestAlgorithm
Definition:
security-common.hpp:105
ndn::KeyClass::PRIVATE
ndn::DigestAlgorithm::BLAKE2B_512
security-common.hpp
ndnSIM
ndn-cxx
src
security
security-common.cpp
Generated on Sun Feb 25 2018 13:27:05 for ndnSIM by
1.8.14