blob: bd709f5d74a7fdfd3c7864a8d2631dab3be8c31d [file] [log] [blame]
Alexander Afanasyevc169a812014-05-20 20:37:29 -04001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
Jeff Thompson7b79eb62013-09-12 18:48:29 -07002/**
Yingdi Yuae734272015-07-04 17:38:48 -07003 * Copyright (c) 2013-2016 Regents of the University of California.
Alexander Afanasyevdfa52c42014-04-24 21:10:11 -07004 *
5 * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
Alexander Afanasyevdfa52c42014-04-24 21:10:11 -07006 *
Alexander Afanasyevc169a812014-05-20 20:37:29 -04007 * 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.
Jeff Thompson7b79eb62013-09-12 18:48:29 -070020 */
21
22#ifndef NDN_SECURITY_COMMON_HPP
Jeff Thompsone589c3f2013-10-12 17:30:50 -070023#define NDN_SECURITY_COMMON_HPP
Jeff Thompson7b79eb62013-09-12 18:48:29 -070024
Yingdi Yuae734272015-07-04 17:38:48 -070025#include "../common.hpp"
26
Alexander Afanasyev2fa59392016-07-29 17:24:23 -070027#define NDN_CXX_KEEP_SECURITY_V1_ALIASES
28
Jeff Thompson7b79eb62013-09-12 18:48:29 -070029namespace ndn {
30
Yingdi Yuae734272015-07-04 17:38:48 -070031namespace signed_interest {
Yingdi Yu0f5fb692014-06-10 12:07:28 -070032
Yingdi Yuae734272015-07-04 17:38:48 -070033const ssize_t POS_SIG_VALUE = -1;
34const ssize_t POS_SIG_INFO = -2;
35const ssize_t POS_RANDOM_VAL = -3;
36const ssize_t POS_TIMESTAMP = -4;
Yingdi Yu0f5fb692014-06-10 12:07:28 -070037
Junxiao Shi198c3812016-08-12 19:24:18 +000038/** \brief minimal number of components for Command Interest
39 * \sa https://redmine.named-data.net/projects/ndn-cxx/wiki/CommandInterest
40 */
Yingdi Yuae734272015-07-04 17:38:48 -070041const size_t MIN_LENGTH = 4;
Yingdi Yu0f5fb692014-06-10 12:07:28 -070042
Junxiao Shi198c3812016-08-12 19:24:18 +000043/** \brief minimal number of components for Signed Interest
44 * \sa https://redmine.named-data.net/projects/ndn-cxx/wiki/SignedInterest
45 */
46const size_t MIN_LENGTH_SIG_ONLY = 2;
47
Yingdi Yu0f5fb692014-06-10 12:07:28 -070048} // namespace signed_interest
49
Yingdi Yu99b2a002015-08-12 12:47:44 -070050enum class KeyType {
51 NONE = 0,
52 RSA = 1,
53 EC = 2,
54 AES = 128
Jeff Thompson7b79eb62013-09-12 18:48:29 -070055};
56
Yingdi Yu99b2a002015-08-12 12:47:44 -070057std::ostream&
58operator<<(std::ostream& os, KeyType keyType);
59
60enum class KeyClass {
61 NONE,
62 PUBLIC,
63 PRIVATE,
64 SYMMETRIC
Jeff Thompson7b79eb62013-09-12 18:48:29 -070065};
Alexander Afanasyevb78bc4d2014-04-09 21:20:52 -070066
Yingdi Yu99b2a002015-08-12 12:47:44 -070067std::ostream&
68operator<<(std::ostream& os, KeyClass keyClass);
69
70enum class DigestAlgorithm {
71 NONE = 0,
72 SHA256 = 1
Jeff Thompson7b79eb62013-09-12 18:48:29 -070073};
74
Yingdi Yu99b2a002015-08-12 12:47:44 -070075std::ostream&
76operator<<(std::ostream& os, DigestAlgorithm algorithm);
77
78enum class BlockCipherAlgorithm {
79 NONE,
80 AES_CBC
Jeff Thompson7b79eb62013-09-12 18:48:29 -070081};
82
Yingdi Yu99b2a002015-08-12 12:47:44 -070083std::ostream&
84operator<<(std::ostream& os, BlockCipherAlgorithm algorithm);
85
Yingdi Yu87516612015-07-10 18:03:52 -070086enum class CipherOperator {
87 DECRYPT = 0,
88 ENCRYPT = 1
89};
90
91std::ostream&
92operator<<(std::ostream& os, CipherOperator op);
93
Yingdi Yu99b2a002015-08-12 12:47:44 -070094enum class AclType {
95 NONE,
96 PUBLIC,
97 PRIVATE
Yingdi Yu2e57a582014-02-20 23:34:43 -080098};
99
Yingdi Yu99b2a002015-08-12 12:47:44 -0700100std::ostream&
101operator<<(std::ostream& os, AclType aclType);
102
Yingdi Yu0f5fb692014-06-10 12:07:28 -0700103} // namespace ndn
Jeff Thompson7b79eb62013-09-12 18:48:29 -0700104
Yingdi Yuae734272015-07-04 17:38:48 -0700105#endif // NDN_SECURITY_COMMON_HPP