security: Add interface to request different key id generation

The option for key id include timestamp, random, and user-specified
value.

This commit only adds the interface, the support to honor the interface
will be implemented later.

Change-Id: I476381ff0fc56cd7906392cb7482b7458e386781
Refs: #2948
diff --git a/src/security/security-common.cpp b/src/security/security-common.cpp
index 0ea60cb..cda5fc5 100644
--- a/src/security/security-common.cpp
+++ b/src/security/security-common.cpp
@@ -25,120 +25,99 @@
 namespace ndn {
 
 std::ostream&
+operator<<(std::ostream& os, KeyIdType keyIdType)
+{
+  switch (keyIdType) {
+    case KeyIdType::USER_SPECIFIED:
+      return os << "USER_SPECIFIED";
+    case KeyIdType::SHA256:
+      return os << "SHA256";
+    case KeyIdType::RANDOM:
+      return os << "RANDOM";
+  }
+  return os << static_cast<int>(keyIdType);
+}
+
+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;
+    case KeyType::NONE:
+      return os << "NONE";
+    case KeyType::RSA:
+      return os << "RSA";
+    case KeyType::EC:
+      return os << "EC";
+    case KeyType::AES:
+      return os << "AES";
   };
-  return os;
+  return os << static_cast<int>(keyType);
 }
 
 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;
+    case KeyClass::NONE:
+      return os << "NONE";
+    case KeyClass::PUBLIC:
+      return os << "PUBLIC";
+    case KeyClass::PRIVATE:
+      return os << "PRIVATE";
+    case KeyClass::SYMMETRIC:
+      return os << "SYMMETRIC";
   };
-  return os;
+  return os << static_cast<int>(keyClass);
 }
 
 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;
+    case DigestAlgorithm::NONE:
+      return os << "NONE";
+    case DigestAlgorithm::SHA256:
+      return os << "SHA256";
   };
-  return os;
+  return os << static_cast<int>(algorithm);
 }
 
 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;
+    case BlockCipherAlgorithm::NONE:
+      return os << "NONE";
+    case BlockCipherAlgorithm::AES_CBC:
+      return os << "AES_CBC";
   };
-  return os;
+  return os << static_cast<int>(algorithm);
 }
 
 std::ostream&
 operator<<(std::ostream& os, CipherOperator op)
 {
   switch (op) {
-  case CipherOperator::DECRYPT:
-    os << "DECRYPT";
-    break;
-  case CipherOperator::ENCRYPT:
-    os << "ENCRYPT";
-    break;
-  default:
-    os << static_cast<int>(op);
-    break;
+    case CipherOperator::DECRYPT:
+      return os << "DECRYPT";
+    case CipherOperator::ENCRYPT:
+      return os << "ENCRYPT";
   };
-  return os;
+  return os << static_cast<int>(op);
 }
 
 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;
+    case AclType::NONE:
+      return os << "NONE";
+    case AclType::PUBLIC:
+      return os << "PUBLIC";
+    case AclType::PRIVATE:
+      return os << "PRIVATE";
   };
-  return os;
+  return os << static_cast<int>(aclType);
 }
 
 } // namespace ndn