bug+codestyle: Fix compile bugs and adjust code style

Change-Id: I008bb538441c099fa25b8b967fbf23ffce13a220
diff --git a/debug-tools/create-cert.cc b/debug-tools/create-cert.cc
index 282c07e..09861d3 100644
--- a/debug-tools/create-cert.cc
+++ b/debug-tools/create-cert.cc
@@ -5,25 +5,25 @@
  * See COPYING for copyright and distribution information.
  */
 
-#include <ndn-cpp-dev/security/key-chain.hpp>
+#include <ndn-cxx/security/key-chain.hpp>
 
 using namespace ndn;
 
-int 
+int
 main()
 {
-  KeyChainImpl<SecPublicInfoSqlite3, SecTpmFile> keyChain;
+  KeyChain keyChain("sqlite3", "file");
   std::vector<CertificateSubjectDescription> subjectDescription;
 
   Name root("/ndn");
   Name rootCertName = keyChain.createIdentity(root);
 
   Name test("/ndn/test");
-  Name testKeyName = keyChain.generateRSAKeyPairAsDefault(test, true);
-  shared_ptr<IdentityCertificate> testCert = 
-    keyChain.prepareUnsignedIdentityCertificate(testKeyName, root, 
+  Name testKeyName = keyChain.generateRsaKeyPairAsDefault(test, true);
+  shared_ptr<IdentityCertificate> testCert =
+    keyChain.prepareUnsignedIdentityCertificate(testKeyName, root,
                                                 time::system_clock::now(),
-                                                time::system_clock::now() + time::days(7300), 
+                                                time::system_clock::now() + time::days(7300),
                                                 subjectDescription);
   keyChain.signByIdentity(*testCert, root);
   keyChain.addCertificateAsIdentityDefault(*testCert);
@@ -31,11 +31,11 @@
   Name alice("/ndn/test/alice");
   if(!keyChain.doesIdentityExist(alice))
     {
-      Name aliceKeyName = keyChain.generateRSAKeyPairAsDefault(alice, true);
-      shared_ptr<IdentityCertificate> aliceCert = 
-	keyChain.prepareUnsignedIdentityCertificate(aliceKeyName, test, 
+      Name aliceKeyName = keyChain.generateRsaKeyPairAsDefault(alice, true);
+      shared_ptr<IdentityCertificate> aliceCert =
+        keyChain.prepareUnsignedIdentityCertificate(aliceKeyName, test,
                                                     time::system_clock::now(),
-                                                    time::system_clock::now() + time::days(7300), 
+                                                    time::system_clock::now() + time::days(7300),
                                                     subjectDescription);
       keyChain.signByIdentity(*aliceCert, test);
       keyChain.addCertificateAsIdentityDefault(*aliceCert);
@@ -44,9 +44,12 @@
   Name bob("/ndn/test/bob");
   if(!keyChain.doesIdentityExist(bob))
     {
-      Name bobKeyName = keyChain.generateRSAKeyPairAsDefault(bob, true);
-      shared_ptr<IdentityCertificate> bobCert = 
-	keyChain.prepareUnsignedIdentityCertificate(bobKeyName, test, getNow(), getNow() + 630720000, subjectDescription);
+      Name bobKeyName = keyChain.generateRsaKeyPairAsDefault(bob, true);
+      shared_ptr<IdentityCertificate> bobCert =
+        keyChain.prepareUnsignedIdentityCertificate(bobKeyName, test,
+                                                    time::system_clock::now(),
+                                                    time::system_clock::now() + time::days(7300),
+                                                    subjectDescription);
       keyChain.signByIdentity(*bobCert, test);
       keyChain.addCertificateAsIdentityDefault(*bobCert);
     }
@@ -54,9 +57,12 @@
   Name cathy("/ndn/test/cathy");
   if(!keyChain.doesIdentityExist(cathy))
     {
-      Name cathyKeyName = keyChain.generateRSAKeyPairAsDefault(cathy, true);
-      shared_ptr<IdentityCertificate> cathyCert = 
-	keyChain.prepareUnsignedIdentityCertificate(cathyKeyName, test, getNow(), getNow() + 630720000, subjectDescription);
+      Name cathyKeyName = keyChain.generateRsaKeyPairAsDefault(cathy, true);
+      shared_ptr<IdentityCertificate> cathyCert =
+        keyChain.prepareUnsignedIdentityCertificate(cathyKeyName, test,
+                                                    time::system_clock::now(),
+                                                    time::system_clock::now() + time::days(7300),
+                                                    subjectDescription);
       keyChain.signByIdentity(*cathyCert, test);
       keyChain.addCertificateAsIdentityDefault(*cathyCert);
     }
diff --git a/debug-tools/dump-cert.cc b/debug-tools/dump-cert.cc
index 6022940..7050175 100644
--- a/debug-tools/dump-cert.cc
+++ b/debug-tools/dump-cert.cc
@@ -5,12 +5,13 @@
  * See COPYING for copyright and distribution information.
  */
 
-#include <ndn-cpp-dev/security/key-chain.hpp>
-#include <ndn-cpp-dev/face.hpp>
+#include "common.hpp"
+#include <ndn-cxx/security/key-chain.hpp>
+#include <ndn-cxx/face.hpp>
 
 using namespace ndn;
 
-int 
+int
 main()
 {
   Name root("/ndn");
@@ -19,23 +20,21 @@
   Name bob("/ndn/test/bob");
   Name cathy("/ndn/test/cathy");
 
-  KeyChainImpl<SecPublicInfoSqlite3, SecTpmFile> keyChain;
+  KeyChain keyChain("sqlite3", "file");
 
-  if(!keyChain.doesIdentityExist(root)
-     || !keyChain.doesIdentityExist(test)
-     || !keyChain.doesIdentityExist(alice)
-     || !keyChain.doesIdentityExist(bob)
-     || !keyChain.doesIdentityExist(cathy))
+  if (!keyChain.doesIdentityExist(root) ||
+      !keyChain.doesIdentityExist(test) ||
+      !keyChain.doesIdentityExist(alice) ||
+      !keyChain.doesIdentityExist(bob) ||
+      !keyChain.doesIdentityExist(cathy))
     return 1;
 
-  shared_ptr<boost::asio::io_service> ioService = make_shared<boost::asio::io_service>();
-  shared_ptr<Face> face = shared_ptr<Face>(new Face(ioService));
-  // shared_ptr<Face> face = make_shared<Face>();
-  
-  face->put(*keyChain.getCertificate(keyChain.getDefaultCertificateNameForIdentity(test)));
-  face->put(*keyChain.getCertificate(keyChain.getDefaultCertificateNameForIdentity(alice)));
-  face->put(*keyChain.getCertificate(keyChain.getDefaultCertificateNameForIdentity(bob)));
-  face->put(*keyChain.getCertificate(keyChain.getDefaultCertificateNameForIdentity(cathy)));
+  Face face;
 
-  ioService->run();
+  face.put(*keyChain.getCertificate(keyChain.getDefaultCertificateNameForIdentity(test)));
+  face.put(*keyChain.getCertificate(keyChain.getDefaultCertificateNameForIdentity(alice)));
+  face.put(*keyChain.getCertificate(keyChain.getDefaultCertificateNameForIdentity(bob)));
+  face.put(*keyChain.getCertificate(keyChain.getDefaultCertificateNameForIdentity(cathy)));
+
+  face.getIoService().run();
 }
diff --git a/debug-tools/dump-local-prefix.cc b/debug-tools/dump-local-prefix.cc
index ba67ac4..7f3af3f 100644
--- a/debug-tools/dump-local-prefix.cc
+++ b/debug-tools/dump-local-prefix.cc
@@ -5,23 +5,23 @@
  * See COPYING for copyright and distribution information.
  */
 
-#include <ndn-cpp-dev/security/key-chain.hpp>
-#include <ndn-cpp-dev/face.hpp>
+#include "common.hpp"
+#include <ndn-cxx/security/key-chain.hpp>
+#include <ndn-cxx/face.hpp>
 
 using namespace ndn;
 
-int 
+int
 main()
 {
   Name root("/ndn");
 
-  KeyChainImpl<SecPublicInfoSqlite3, SecTpmFile> keyChain;
+  KeyChain keyChain("sqlite3", "file");
 
   if(!keyChain.doesIdentityExist(root))
     return 1;
 
-  shared_ptr<boost::asio::io_service> ioService = make_shared<boost::asio::io_service>();
-  shared_ptr<Face> face = shared_ptr<Face>(new Face(ioService));
+  Face face;
 
   Name name("/local/ndn/prefix");
   name.appendVersion().appendSegment(0);
@@ -30,8 +30,8 @@
   std::string prefix("/ndn/test");
   data.setContent(reinterpret_cast<const uint8_t*>(prefix.c_str()), prefix.size());
   keyChain.signByIdentity(data, root);
-  
-  face->put(data);
 
-  ioService->run();
+  face.put(data);
+
+  face.getIoService().run();
 }