security: change enum to enum class in security-common.hpp
Change-Id: I5565c845cd57f3457c8120b11399a105fa83418d
Refs: #3083
diff --git a/src/security/security-common.cpp b/src/security/security-common.cpp
new file mode 100644
index 0000000..0f8714d
--- /dev/null
+++ b/src/security/security-common.cpp
@@ -0,0 +1,127 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2013-2016 Regents of the University of California.
+ *
+ * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
+ *
+ * ndn-cxx library is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ *
+ * You should have received copies of the GNU General Public License and GNU Lesser
+ * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
+ */
+
+#include "security-common.hpp"
+#include <ostream>
+
+namespace ndn {
+
+std::ostream&
+operator<<(std::ostream& os, KeyType keyType)
+{
+ switch (keyType) {
+ case KeyType::NONE:
+ os << "NONE";
+ break;
+ case KeyType::RSA:
+ os << "RSA";
+ break;
+ case KeyType::EC:
+ os << "EC";
+ break;
+ case KeyType::AES:
+ os << "AES";
+ break;
+ default:
+ os << static_cast<int>(keyType);
+ break;
+ };
+ return os;
+}
+
+std::ostream&
+operator<<(std::ostream& os, KeyClass keyClass)
+{
+ switch (keyClass) {
+ case KeyClass::NONE:
+ os << "NONE";
+ break;
+ case KeyClass::PUBLIC:
+ os << "PUBLIC";
+ break;
+ case KeyClass::PRIVATE:
+ os << "PRIVATE";
+ break;
+ case KeyClass::SYMMETRIC:
+ os << "SYMMETRIC";
+ break;
+ default:
+ os << static_cast<int>(keyClass);
+ break;
+ };
+ return os;
+}
+
+std::ostream&
+operator<<(std::ostream& os, DigestAlgorithm algorithm)
+{
+ switch (algorithm) {
+ case DigestAlgorithm::NONE:
+ os << "NONE";
+ break;
+ case DigestAlgorithm::SHA256:
+ os << "SHA256";
+ break;
+ default:
+ os << static_cast<int>(algorithm);
+ break;
+ };
+ return os;
+}
+
+std::ostream&
+operator<<(std::ostream& os, BlockCipherAlgorithm algorithm)
+{
+ switch (algorithm) {
+ case BlockCipherAlgorithm::NONE:
+ os << "NONE";
+ break;
+ case BlockCipherAlgorithm::AES_CBC:
+ os << "AES_CBC";
+ break;
+ default:
+ os << static_cast<int>(algorithm);
+ break;
+ };
+ return os;
+}
+
+std::ostream&
+operator<<(std::ostream& os, AclType aclType)
+{
+ switch (aclType) {
+ case AclType::NONE:
+ os << "NONE";
+ break;
+ case AclType::PUBLIC:
+ os << "PUBLIC";
+ break;
+ case AclType::PRIVATE:
+ os << "PRIVATE";
+ break;
+ default:
+ os << static_cast<int>(aclType);
+ break;
+ };
+ return os;
+}
+
+} // namespace ndn