blob: 0ea60cb5efb59027b5a4bba0700e396be2864fdd [file] [log] [blame]
Yingdi Yu99b2a002015-08-12 12:47:44 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (c) 2013-2016 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#include <ostream>
24
25namespace ndn {
26
27std::ostream&
28operator<<(std::ostream& os, KeyType keyType)
29{
30 switch (keyType) {
31 case KeyType::NONE:
32 os << "NONE";
33 break;
34 case KeyType::RSA:
35 os << "RSA";
36 break;
37 case KeyType::EC:
38 os << "EC";
39 break;
40 case KeyType::AES:
41 os << "AES";
42 break;
43 default:
44 os << static_cast<int>(keyType);
45 break;
46 };
47 return os;
48}
49
50std::ostream&
51operator<<(std::ostream& os, KeyClass keyClass)
52{
53 switch (keyClass) {
54 case KeyClass::NONE:
55 os << "NONE";
56 break;
57 case KeyClass::PUBLIC:
58 os << "PUBLIC";
59 break;
60 case KeyClass::PRIVATE:
61 os << "PRIVATE";
62 break;
63 case KeyClass::SYMMETRIC:
64 os << "SYMMETRIC";
65 break;
66 default:
67 os << static_cast<int>(keyClass);
68 break;
69 };
70 return os;
71}
72
73std::ostream&
74operator<<(std::ostream& os, DigestAlgorithm algorithm)
75{
76 switch (algorithm) {
77 case DigestAlgorithm::NONE:
78 os << "NONE";
79 break;
80 case DigestAlgorithm::SHA256:
81 os << "SHA256";
82 break;
83 default:
84 os << static_cast<int>(algorithm);
85 break;
86 };
87 return os;
88}
89
90std::ostream&
91operator<<(std::ostream& os, BlockCipherAlgorithm algorithm)
92{
93 switch (algorithm) {
94 case BlockCipherAlgorithm::NONE:
95 os << "NONE";
96 break;
97 case BlockCipherAlgorithm::AES_CBC:
98 os << "AES_CBC";
99 break;
100 default:
101 os << static_cast<int>(algorithm);
102 break;
103 };
104 return os;
105}
106
107std::ostream&
Yingdi Yu87516612015-07-10 18:03:52 -0700108operator<<(std::ostream& os, CipherOperator op)
109{
110 switch (op) {
111 case CipherOperator::DECRYPT:
112 os << "DECRYPT";
113 break;
114 case CipherOperator::ENCRYPT:
115 os << "ENCRYPT";
116 break;
117 default:
118 os << static_cast<int>(op);
119 break;
120 };
121 return os;
122}
123
124std::ostream&
Yingdi Yu99b2a002015-08-12 12:47:44 -0700125operator<<(std::ostream& os, AclType aclType)
126{
127 switch (aclType) {
128 case AclType::NONE:
129 os << "NONE";
130 break;
131 case AclType::PUBLIC:
132 os << "PUBLIC";
133 break;
134 case AclType::PRIVATE:
135 os << "PRIVATE";
136 break;
137 default:
138 os << static_cast<int>(aclType);
139 break;
140 };
141 return os;
142}
143
144} // namespace ndn