Use standard BLOB,KEY,NACK as contentType instead of customized types

Change-Id: I792e19b8f1e2aa359605da44074fc25bf7963a9a
diff --git a/src/clients/response.cpp b/src/clients/response.cpp
index 0bbc9de..b1c3865 100644
--- a/src/clients/response.cpp
+++ b/src/clients/response.cpp
@@ -43,7 +43,7 @@
 inline size_t
 Response::wireEncode(EncodingImpl<T>& block) const
 {
-  if (m_contentType == NDNS_BLOB) {
+  if (m_contentType == NDNS_BLOB || m_contentType == NDNS_KEY) {
     // Raw application content
     return block.prependBlock(m_appContent);
   }
@@ -66,7 +66,7 @@
 const Block
 Response::wireEncode() const
 {
-  if (m_contentType == NDNS_BLOB) {
+  if (m_contentType == NDNS_BLOB || m_contentType == NDNS_KEY) {
     return m_appContent;
   }
 
@@ -80,7 +80,7 @@
 void
 Response::wireDecode(const Block& wire)
 {
-  if (m_contentType == NDNS_BLOB) {
+  if (m_contentType == NDNS_BLOB || m_contentType == NDNS_KEY) {
     m_appContent = wire;
     return;
   }
@@ -137,7 +137,7 @@
 
   shared_ptr<Data> data = make_shared<Data>(name);
 
-  if (m_contentType != NDNS_BLOB) {
+  if (m_contentType != NDNS_BLOB && m_contentType != NDNS_KEY) {
     data->setContent(this->wireEncode());
   }
   else {
@@ -198,7 +198,7 @@
   if (tmp == false)
     return tmp;
 
-  if (m_contentType == NDNS_BLOB) {
+  if (m_contentType == NDNS_BLOB || m_contentType == NDNS_KEY) {
     return tmp && (getAppContent() == other.getAppContent());
   }
   else
@@ -215,7 +215,8 @@
      << " version=" << response.getVersion()
      << " freshnessPeriod=" << response.getFreshnessPeriod()
      << " NdnsContentType=" << response.getContentType();
-  if (response.getContentType() == NDNS_BLOB) {
+  if (response.getContentType() == NDNS_BLOB
+      || response.getContentType() == NDNS_KEY) {
     if (response.getAppContent().empty())
       os << " appContent=NULL";
     else
diff --git a/src/daemon/rrset-factory.cpp b/src/daemon/rrset-factory.cpp
index a75c650..9395f42 100644
--- a/src/daemon/rrset-factory.cpp
+++ b/src/daemon/rrset-factory.cpp
@@ -216,7 +216,7 @@
   Data data(name);
   data.setContent(cert.wireEncode());
 
-  setContentType(data, NDNS_BLOB, ttl);
+  setContentType(data, NDNS_KEY, ttl);
   sign(data);
   rrset.setData(data.wireEncode());
 
diff --git a/src/daemon/rrset-factory.hpp b/src/daemon/rrset-factory.hpp
index 8318bb8..e5165d3 100644
--- a/src/daemon/rrset-factory.hpp
+++ b/src/daemon/rrset-factory.hpp
@@ -107,8 +107,9 @@
   void
   sign(Data& data);
 
-  void setContentType(Data& data, NdnsContentType contentType,
-                      const time::seconds& ttl);
+  void
+  setContentType(Data& data, NdnsContentType contentType,
+                 const time::seconds& ttl);
 
 private:
   KeyChain& m_keyChain;
diff --git a/src/mgmt/management-tool.cpp b/src/mgmt/management-tool.cpp
index 0ddf57b..9ac19e5 100644
--- a/src/mgmt/management-tool.cpp
+++ b/src/mgmt/management-tool.cpp
@@ -345,11 +345,13 @@
     Data data(rrset.getData());
     Response re;
     re.fromData(zoneName, data);
-    int iteration = re.getContentType() == NDNS_BLOB || re.getContentType() == NDNS_AUTH ?
-                      1 : re.getRrs().size();
+    int iteration = re.getContentType() == NDNS_BLOB
+                    || re.getContentType() == NDNS_KEY
+                    || re.getContentType() == NDNS_AUTH ? 1 : re.getRrs().size();
+
     const std::vector<Block> &rrs = re.getRrs();
 
-    if (re.getContentType() != NDNS_BLOB) {
+    if (re.getContentType() != NDNS_BLOB && re.getContentType() != NDNS_KEY) {
       os << "; rrset=" << rrset.getLabel().toUri()
          << " type=" << rrset.getType().toUri()
          << " version=" << rrset.getVersion().toUri()
@@ -368,7 +370,7 @@
       os.width(typeWidth + 2);
       os << rrset.getType().toUri();
 
-      if (re.getContentType() != NDNS_BLOB) {
+      if (re.getContentType() != NDNS_BLOB && re.getContentType() != NDNS_KEY) {
         using namespace CryptoPP;
         if (rrset.getType() == label::TXT_RR_TYPE) {
           os.write(reinterpret_cast<const char*>(rrs[i].value()), rrs[i].value_size());
@@ -397,14 +399,15 @@
       }
     }
 
-    if (re.getContentType() == NDNS_BLOB) {
+    if (re.getContentType() == NDNS_BLOB || re.getContentType() == NDNS_KEY) {
       os.width();
       os << "; content-type=" << re.getContentType()
          << " version=" << rrset.getVersion().toUri()
          << " signed-by=" << data.getSignature().getKeyLocator().getName().toUri();
       os << std::endl;
 
-      if (printRaw && re.getContentType() == NDNS_BLOB) {
+      if (printRaw && (re.getContentType() == NDNS_BLOB
+                       || re.getContentType() == NDNS_KEY)) {
         util::IndentedStream istream(os, "; ");
 
         if (re.getRrType() == label::CERT_RR_TYPE) {
diff --git a/src/util/util.cpp b/src/util/util.cpp
index 31f3549..bbdf0c2 100644
--- a/src/util/util.cpp
+++ b/src/util/util.cpp
@@ -36,6 +36,8 @@
     return NDNS_BLOB;
   else if (str == "link")
     return NDNS_LINK;
+  else if (str == "key")
+    return NDNS_LINK;
   else
     return NDNS_UNKNOWN;
 }