Yingdi Yu | 99b2a00 | 2015-08-12 12:47:44 -0700 | [diff] [blame^] | 1 | /* -*- 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 | |
| 25 | namespace ndn { |
| 26 | |
| 27 | std::ostream& |
| 28 | operator<<(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 | |
| 50 | std::ostream& |
| 51 | operator<<(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 | |
| 73 | std::ostream& |
| 74 | operator<<(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 | |
| 90 | std::ostream& |
| 91 | operator<<(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 | |
| 107 | std::ostream& |
| 108 | operator<<(std::ostream& os, AclType aclType) |
| 109 | { |
| 110 | switch (aclType) { |
| 111 | case AclType::NONE: |
| 112 | os << "NONE"; |
| 113 | break; |
| 114 | case AclType::PUBLIC: |
| 115 | os << "PUBLIC"; |
| 116 | break; |
| 117 | case AclType::PRIVATE: |
| 118 | os << "PRIVATE"; |
| 119 | break; |
| 120 | default: |
| 121 | os << static_cast<int>(aclType); |
| 122 | break; |
| 123 | }; |
| 124 | return os; |
| 125 | } |
| 126 | |
| 127 | } // namespace ndn |