blob: 20d8040f7b7adced896bea7efe88c121e13714e6 [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 Yu6ee2d362015-07-16 21:48:05 -07003 * Copyright (c) 2013-2017 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
Yingdi Yu6ee2d362015-07-16 21:48:05 -070022#ifndef NDN_SECURITY_SECURITY_COMMON_HPP
23#define NDN_SECURITY_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;
Alexander Afanasyev70244f42017-01-04 12:47:12 -080035
36/** \brief minimal number of components for Signed Interest
37 * \sa https://redmine.named-data.net/projects/ndn-cxx/wiki/SignedInterest
38 */
39const size_t MIN_SIZE = 2;
40
Alexander Afanasyev70244f42017-01-04 12:47:12 -080041} // namespace signed_interest
42
43namespace command_interest {
44
45using signed_interest::POS_SIG_VALUE;
46using signed_interest::POS_SIG_INFO;
Yingdi Yuae734272015-07-04 17:38:48 -070047const ssize_t POS_RANDOM_VAL = -3;
48const ssize_t POS_TIMESTAMP = -4;
Yingdi Yu0f5fb692014-06-10 12:07:28 -070049
Junxiao Shi198c3812016-08-12 19:24:18 +000050/** \brief minimal number of components for Command Interest
51 * \sa https://redmine.named-data.net/projects/ndn-cxx/wiki/CommandInterest
52 */
Alexander Afanasyev70244f42017-01-04 12:47:12 -080053const size_t MIN_SIZE = 4;
Yingdi Yu0f5fb692014-06-10 12:07:28 -070054
Alexander Afanasyev70244f42017-01-04 12:47:12 -080055} // namespace command_interest
56
Yingdi Yuc08d7d62015-07-16 21:05:11 -070057/**
58 * @brief The type of KeyId component in a key name
59 */
60enum class KeyIdType {
61 /**
62 * @brief User-specified key ID
63 *
64 * It is user's responsibility to assure the uniqueness of the key names.
65 */
66 USER_SPECIFIED = 0,
67 /**
68 * @brief Use the SHA256 hash of the public key as the key id
69 *
70 * This KeyId type guarantees the uniqueness of the key names.
71 */
72 SHA256 = 1,
73 /**
74 * @brief Use a 64-bit random number as the key id
75 *
76 * This KeyId provides roughly uniqueness of the key names.
77 */
78 RANDOM = 2
79};
80
81std::ostream&
82operator<<(std::ostream& os, KeyIdType keyIdType);
83
Yingdi Yu99b2a002015-08-12 12:47:44 -070084enum class KeyType {
85 NONE = 0,
86 RSA = 1,
87 EC = 2,
88 AES = 128
Jeff Thompson7b79eb62013-09-12 18:48:29 -070089};
90
Yingdi Yu99b2a002015-08-12 12:47:44 -070091std::ostream&
92operator<<(std::ostream& os, KeyType keyType);
93
94enum class KeyClass {
95 NONE,
96 PUBLIC,
97 PRIVATE,
98 SYMMETRIC
Jeff Thompson7b79eb62013-09-12 18:48:29 -070099};
Alexander Afanasyevb78bc4d2014-04-09 21:20:52 -0700100
Yingdi Yu99b2a002015-08-12 12:47:44 -0700101std::ostream&
102operator<<(std::ostream& os, KeyClass keyClass);
103
104enum class DigestAlgorithm {
105 NONE = 0,
106 SHA256 = 1
Jeff Thompson7b79eb62013-09-12 18:48:29 -0700107};
108
Yingdi Yu99b2a002015-08-12 12:47:44 -0700109std::ostream&
110operator<<(std::ostream& os, DigestAlgorithm algorithm);
111
112enum class BlockCipherAlgorithm {
113 NONE,
114 AES_CBC
Jeff Thompson7b79eb62013-09-12 18:48:29 -0700115};
116
Yingdi Yu99b2a002015-08-12 12:47:44 -0700117std::ostream&
118operator<<(std::ostream& os, BlockCipherAlgorithm algorithm);
119
Yingdi Yu87516612015-07-10 18:03:52 -0700120enum class CipherOperator {
121 DECRYPT = 0,
122 ENCRYPT = 1
123};
124
125std::ostream&
126operator<<(std::ostream& os, CipherOperator op);
127
Yingdi Yu99b2a002015-08-12 12:47:44 -0700128enum class AclType {
129 NONE,
130 PUBLIC,
131 PRIVATE
Yingdi Yu2e57a582014-02-20 23:34:43 -0800132};
133
Yingdi Yu99b2a002015-08-12 12:47:44 -0700134std::ostream&
135operator<<(std::ostream& os, AclType aclType);
136
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800137namespace security {
138namespace transform {
139class PublicKey;
140} // namespace transform
141namespace v2 {
142using transform::PublicKey;
143} // namespace v2
144} // namespace security
145
Yingdi Yu0f5fb692014-06-10 12:07:28 -0700146} // namespace ndn
Jeff Thompson7b79eb62013-09-12 18:48:29 -0700147
Yingdi Yu6ee2d362015-07-16 21:48:05 -0700148#endif // NDN_SECURITY_SECURITY_COMMON_HPP