ndn-cxx: NDN C++ Library 0.9.0-33-g832ea91d
Loading...
Searching...
No Matches
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-2024 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_CXX_SECURITY_SECURITY_COMMON_HPP
23#define NDN_CXX_SECURITY_SECURITY_COMMON_HPP
24
25#include "ndn-cxx/util/span.hpp"
26
27#include <cstdint>
28#include <iosfwd>
29#include <vector>
30
31namespace ndn {
32
33namespace signed_interest {
34
36inline constexpr ssize_t POS_SIG_VALUE = -1;
38inline constexpr ssize_t POS_SIG_INFO = -2;
39
45inline constexpr size_t MIN_SIZE = 2;
46
47} // namespace signed_interest
48
49namespace command_interest {
50
52inline constexpr ssize_t POS_SIG_VALUE = -1;
54inline constexpr ssize_t POS_SIG_INFO = -2;
56inline constexpr ssize_t POS_RANDOM_VAL = -3;
58inline constexpr ssize_t POS_TIMESTAMP = -4;
59
65inline constexpr size_t MIN_SIZE = 4;
66
67} // namespace command_interest
68
69#ifndef DOXYGEN
70using InputBuffers = std::vector<span<const uint8_t>>;
71#else
73class InputBuffers;
74#endif
75
79enum class KeyIdType {
91 SHA256 = 1,
97 RANDOM = 2,
98};
99
100std::ostream&
101operator<<(std::ostream& os, KeyIdType keyIdType);
102
106enum class KeyType {
107 NONE = 0,
108 RSA,
109 EC,
110 AES,
111 HMAC,
112};
113
114std::ostream&
115operator<<(std::ostream& os, KeyType keyType);
116
117enum class DigestAlgorithm {
118 NONE = 0,
119 SHA224,
120 SHA256,
121 SHA384,
122 SHA512,
125 SHA3_224,
126 SHA3_256,
127 SHA3_384,
128 SHA3_512,
129};
130
131std::ostream&
132operator<<(std::ostream& os, DigestAlgorithm algorithm);
133
135 NONE,
136 AES_CBC,
137};
138
139std::ostream&
140operator<<(std::ostream& os, BlockCipherAlgorithm algorithm);
141
142enum class CipherOperator {
143 DECRYPT,
144 ENCRYPT,
145};
146
147std::ostream&
148operator<<(std::ostream& os, CipherOperator op);
149
150} // namespace ndn
151
152#endif // NDN_CXX_SECURITY_SECURITY_COMMON_HPP
constexpr ssize_t POS_SIG_VALUE
constexpr size_t MIN_SIZE
Minimum number of name components for a Command Interest.
constexpr ssize_t POS_RANDOM_VAL
constexpr ssize_t POS_SIG_INFO
constexpr ssize_t POS_TIMESTAMP
constexpr ssize_t POS_SIG_VALUE
constexpr size_t MIN_SIZE
Minimum number of name components for an old-style Signed Interest.
constexpr ssize_t POS_SIG_INFO
Definition data.cpp:25
KeyType
The type of a cryptographic key.
@ EC
Elliptic Curve key (e.g. for ECDSA), supports sign/verify operations.
@ RSA
RSA key, supports sign/verify and encrypt/decrypt operations.
@ AES
AES key, supports encrypt/decrypt operations.
@ NONE
Unknown or unsupported key type.
@ HMAC
HMAC key, supports sign/verify operations.
KeyIdType
The type of KeyId component in a key name.
@ RANDOM
Use a 64-bit random number as key id.
@ USER_SPECIFIED
User-specified key id.
@ SHA256
Use the SHA-256 hash of the public key as key id.
std::ostream & operator<<(std::ostream &os, const Data &data)
Definition data.cpp:377