NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
security-common.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2013-2019 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 #ifndef NDN_SECURITY_SECURITY_COMMON_HPP
23 #define NDN_SECURITY_SECURITY_COMMON_HPP
24 
26 
27 namespace ndn {
28 
29 namespace signed_interest {
30 
31 const ssize_t POS_SIG_VALUE = -1;
32 const ssize_t POS_SIG_INFO = -2;
33 
37 const size_t MIN_SIZE = 2;
38 
39 } // namespace signed_interest
40 
41 namespace command_interest {
42 
45 const ssize_t POS_RANDOM_VAL = -3;
46 const ssize_t POS_TIMESTAMP = -4;
47 
51 const size_t MIN_SIZE = 4;
52 
53 } // namespace command_interest
54 
58 enum class KeyIdType {
64  USER_SPECIFIED = 0,
70  SHA256 = 1,
76  RANDOM = 2,
77 };
78 
79 std::ostream&
80 operator<<(std::ostream& os, KeyIdType keyIdType);
81 
85 enum class KeyType {
86  NONE = 0,
87  RSA,
88  EC,
89  AES,
90  HMAC,
91 };
92 
93 std::ostream&
94 operator<<(std::ostream& os, KeyType keyType);
95 
96 enum class DigestAlgorithm {
97  NONE = 0,
98  SHA224,
99  SHA256,
100  SHA384,
101  SHA512,
102  BLAKE2B_512,
103  BLAKE2S_256,
104  SHA3_224,
105  SHA3_256,
106  SHA3_384,
107  SHA3_512,
108 };
109 
110 std::ostream&
111 operator<<(std::ostream& os, DigestAlgorithm algorithm);
112 
114  NONE,
115  AES_CBC,
116 };
117 
118 std::ostream&
119 operator<<(std::ostream& os, BlockCipherAlgorithm algorithm);
120 
121 enum class CipherOperator {
122  DECRYPT,
123  ENCRYPT,
124 };
125 
126 std::ostream&
127 operator<<(std::ostream& os, CipherOperator op);
128 
129 } // namespace ndn
130 
131 #endif // NDN_SECURITY_SECURITY_COMMON_HPP
common.hpp
Common includes and macros used throughout the library.
ndn::KeyType
KeyType
The type of a cryptographic key.
Definition: security-common.hpp:85
ndn::command_interest::POS_RANDOM_VAL
const ssize_t POS_RANDOM_VAL
Definition: security-common.hpp:45
ndn::DigestAlgorithm::SHA224
@ SHA224
ndn::KeyIdType::RANDOM
@ RANDOM
Use a 64-bit random number as key id.
ndn::KeyIdType
KeyIdType
The type of KeyId component in a key name.
Definition: security-common.hpp:58
ndn::DigestAlgorithm::SHA256
@ SHA256
ndn::DigestAlgorithm::NONE
@ NONE
ndn::CipherOperator::DECRYPT
@ DECRYPT
ndn::KeyType::EC
@ EC
Elliptic Curve key (e.g. for ECDSA), supports sign/verify operations.
ndn::BlockCipherAlgorithm::NONE
@ NONE
ndn::DigestAlgorithm
DigestAlgorithm
Definition: security-common.hpp:96
ndn::DigestAlgorithm::SHA3_384
@ SHA3_384
ndn::signed_interest::POS_SIG_VALUE
const ssize_t POS_SIG_VALUE
Definition: security-common.hpp:31
ndn::CipherOperator::ENCRYPT
@ ENCRYPT
ndn::KeyIdType::SHA256
@ SHA256
Use the SHA256 hash of the public key as key id.
ndn::DigestAlgorithm::SHA512
@ SHA512
ndn::KeyType::HMAC
@ HMAC
HMAC key, supports sign/verify operations.
ndn::command_interest::POS_TIMESTAMP
const ssize_t POS_TIMESTAMP
Definition: security-common.hpp:46
ndn::DigestAlgorithm::SHA3_256
@ SHA3_256
ndn::command_interest::MIN_SIZE
const size_t MIN_SIZE
minimal number of components for Command Interest
Definition: security-common.hpp:51
ndn::signed_interest::POS_SIG_INFO
const ssize_t POS_SIG_INFO
Definition: security-common.hpp:32
ndn::DigestAlgorithm::BLAKE2S_256
@ BLAKE2S_256
ndn::DigestAlgorithm::SHA3_512
@ SHA3_512
ndn::DigestAlgorithm::BLAKE2B_512
@ BLAKE2B_512
ndn::BlockCipherAlgorithm::AES_CBC
@ AES_CBC
ndn::DigestAlgorithm::SHA3_224
@ SHA3_224
ndn::DigestAlgorithm::SHA384
@ SHA384
ndn::KeyType::NONE
@ NONE
Unknown or unsupported key type.
ndn::operator<<
std::ostream & operator<<(std::ostream &os, const Data &data)
Definition: data.cpp:322
ndn::KeyIdType::USER_SPECIFIED
@ USER_SPECIFIED
User-specified key id.
ndn::signed_interest::MIN_SIZE
const size_t MIN_SIZE
minimal number of components for Signed Interest
Definition: security-common.hpp:37
ndn::CipherOperator
CipherOperator
Definition: security-common.hpp:121
ndn::BlockCipherAlgorithm
BlockCipherAlgorithm
Definition: security-common.hpp:113
ndn::KeyType::AES
@ AES
AES key, supports encrypt/decrypt operations.
ndn::KeyType::RSA
@ RSA
RSA key, supports sign/verify and encrypt/decrypt operations.
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-strategy-choice-helper.hpp:34