security: Reorganizing source code to prepare for support of two version of NDN certificates

This commit also removes unused ndn_digestSha256 function and deprecates
crypto::sha256 in favor of crypto::computeSha256Digest in util/crypto.hpp.

Change-Id: I24ee50ff073a96b868633bdf2cfade412d3605f3
Refs: #3098
diff --git a/src/security/sec-tpm.cpp b/src/security/sec-tpm.cpp
index 14e71fa..2ce3d66 100644
--- a/src/security/sec-tpm.cpp
+++ b/src/security/sec-tpm.cpp
@@ -25,14 +25,13 @@
 
 #include "../encoding/oid.hpp"
 #include "../encoding/buffer-stream.hpp"
-#include "cryptopp.hpp"
+#include "v1/cryptopp.hpp"
 #include <unistd.h>
 
 namespace ndn {
+namespace security {
 
-using std::string;
-
-SecTpm::SecTpm(const string& location)
+SecTpm::SecTpm(const std::string& location)
   : m_location(location)
 {
 }
@@ -48,7 +47,7 @@
 }
 
 ConstBufferPtr
-SecTpm::exportPrivateKeyPkcs5FromTpm(const Name& keyName, const string& passwordStr)
+SecTpm::exportPrivateKeyPkcs5FromTpm(const Name& keyName, const std::string& passwordStr)
 {
   using namespace CryptoPP;
 
@@ -94,9 +93,9 @@
   }
 
   // encode
-  OID pbes2Id("1.2.840.113549.1.5.13");
-  OID pbkdf2Id("1.2.840.113549.1.5.12");
-  OID pbes2encsId("1.2.840.113549.3.7");
+  Oid pbes2Id("1.2.840.113549.1.5.13");
+  Oid pbkdf2Id("1.2.840.113549.1.5.12");
+  Oid pbes2encsId("1.2.840.113549.3.7");
 
   OBufferStream pkcs8Os;
   try {
@@ -167,15 +166,15 @@
 bool
 SecTpm::importPrivateKeyPkcs5IntoTpm(const Name& keyName,
                                      const uint8_t* buf, size_t size,
-                                     const string& passwordStr)
+                                     const std::string& passwordStr)
 {
   using namespace CryptoPP;
 
-  OID pbes2Id;
-  OID pbkdf2Id;
+  Oid pbes2Id;
+  Oid pbkdf2Id;
   SecByteBlock saltBlock;
   uint32_t iterationCount;
-  OID pbes2encsId;
+  Oid pbes2encsId;
   SecByteBlock ivBlock;
   SecByteBlock encryptedDataBlock;
 
@@ -290,11 +289,11 @@
     BERDecodeUnsigned<uint32_t>(privateKeyInfo, versionNum, INTEGER);
     BERSequenceDecoder sequenceDecoder(privateKeyInfo);
     {
-      OID keyTypeOID;
-      keyTypeOID.decode(sequenceDecoder);
-      if (keyTypeOID == oid::RSA)
+      Oid keyTypeOid;
+      keyTypeOid.decode(sequenceDecoder);
+      if (keyTypeOid == oid::RSA)
         publicKeyType = KeyType::RSA;
-      else if (keyTypeOID == oid::ECDSA)
+      else if (keyTypeOid == oid::ECDSA)
         publicKeyType = KeyType::EC;
       else
         return false; // Unsupported key type;
@@ -382,5 +381,5 @@
   return isInitialized;
 }
 
-
+} // namespace security
 } // namespace ndn