security+node: Fixing includes and removing deprecated files

Change-Id: If1565b8ae9c1c1dd78a0bc0490c76a836c1ceacf
diff --git a/Makefile.am b/Makefile.am
index dd020d6..a6818df 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -106,8 +106,6 @@
   src/security/key-chain.cpp \
   src/security/policy/no-verify-policy-manager.cpp \
   src/security/policy/self-verify-policy-manager.cpp \
-  src/security/security-exception.cpp \
-  src/security/signature/sha256-with-rsa-handler.cpp \
   src/transport/unix-transport.cpp \
   src/util/blob-stream.hpp \
   src/util/blob.cpp \
diff --git a/src/node.cpp b/src/node.cpp
index 3234f18..1ae1d3b 100644
--- a/src/node.cpp
+++ b/src/node.cpp
@@ -13,11 +13,15 @@
 #include <ndn-cpp/node.hpp>
 
 #include "util/ndnd-id-fetcher.hpp"
-#include "security/signature/signature-sha256-with-rsa.hpp"
 
-#include "status-response.hpp"
+#include <ndn-cpp/security/signature/signature-sha256-with-rsa.hpp>
+#include <ndn-cpp/status-response.hpp>
 
 using namespace std;
+#if NDN_CPP_HAVE_CXX11
+// In the std library, the placeholders are in a different namespace than boost.
+using namespace ndn::func_lib::placeholders;
+#endif
 
 namespace ndn {
 
diff --git a/src/security/certificate/certificate.cpp b/src/security/certificate/certificate.cpp
index 7a70cdc..414785d 100644
--- a/src/security/certificate/certificate.cpp
+++ b/src/security/certificate/certificate.cpp
@@ -8,7 +8,7 @@
 
 #include <ndn-cpp/common.hpp>
 
-#include "certificate.hpp"
+#include <ndn-cpp/security/certificate/certificate.hpp>
 
 #if NDN_CPP_USE_SYSTEM_BOOST
 #include <boost/iostreams/stream.hpp>
diff --git a/src/security/certificate/public-key.cpp b/src/security/certificate/public-key.cpp
index 131e3c1..205dcd2 100644
--- a/src/security/certificate/public-key.cpp
+++ b/src/security/certificate/public-key.cpp
@@ -7,8 +7,7 @@
  */
 
 #include <ndn-cpp/common.hpp>
-
-#include "public-key.hpp"
+#include <ndn-cpp/security/certificate/public-key.hpp>
 
 #if NDN_CPP_USE_SYSTEM_BOOST
 #include <boost/iostreams/stream.hpp>
diff --git a/src/security/identity/basic-identity-storage.cpp b/src/security/identity/basic-identity-storage.cpp
index da0e991..7a31c25 100644
--- a/src/security/identity/basic-identity-storage.cpp
+++ b/src/security/identity/basic-identity-storage.cpp
@@ -19,7 +19,7 @@
 #include "ndn-cpp/data.hpp"
 #include <ndn-cpp/security/certificate/identity-certificate.hpp>
 #include "../../c/util/time.h"
-#include <ndn-cpp/signature/signature-sha256-with-rsa.hpp>
+#include <ndn-cpp/security/signature/signature-sha256-with-rsa.hpp>
 
 
 INIT_LOGGER("BasicIdentityStorage");
diff --git a/src/security/identity/identity-manager.cpp b/src/security/identity/identity-manager.cpp
index 0c57212..44f0d0b 100644
--- a/src/security/identity/identity-manager.cpp
+++ b/src/security/identity/identity-manager.cpp
@@ -21,8 +21,8 @@
 #include "../../util/logging.hpp"
 #include "../../c/util/time.h"
 #include <ndn-cpp/security/identity/identity-manager.hpp>
-#include "../certificate/identity-certificate.hpp"
-#include "../signature/signature-sha256-with-rsa.hpp"
+#include <ndn-cpp/security/certificate/identity-certificate.hpp>
+#include <ndn-cpp/security/signature/signature-sha256-with-rsa.hpp>
 
 INIT_LOGGER("ndn.security.IdentityManager")
 
diff --git a/src/security/identity/memory-identity-storage.cpp b/src/security/identity/memory-identity-storage.cpp
index 117ca35..81881a8 100644
--- a/src/security/identity/memory-identity-storage.cpp
+++ b/src/security/identity/memory-identity-storage.cpp
@@ -5,7 +5,7 @@
  * See COPYING for copyright and distribution information.
  */
 
-#include "memory-identity-storage.hpp"
+#include <ndn-cpp/security/identity/memory-identity-storage.hpp>
 
 #include <algorithm>
 #include <ndn-cpp/security/certificate/identity-certificate.hpp>
diff --git a/src/security/identity/memory-private-key-storage.cpp b/src/security/identity/memory-private-key-storage.cpp
index 1394126..e1442be 100644
--- a/src/security/identity/memory-private-key-storage.cpp
+++ b/src/security/identity/memory-private-key-storage.cpp
@@ -5,8 +5,8 @@
  * See COPYING for copyright and distribution information.
  */
 
-#include "memory-private-key-storage.hpp"
-#include "../certificate/public-key.hpp"
+#include <ndn-cpp/security/identity/memory-private-key-storage.hpp>
+#include <ndn-cpp/security/certificate/public-key.hpp>
 #include <openssl/ssl.h>
 #include <openssl/sha.h>
 #include <openssl/rsa.h>
diff --git a/src/security/identity/osx-private-key-storage.cpp b/src/security/identity/osx-private-key-storage.cpp
index fec7671..adf3542 100644
--- a/src/security/identity/osx-private-key-storage.cpp
+++ b/src/security/identity/osx-private-key-storage.cpp
@@ -13,8 +13,9 @@
 #include <sstream>
 
 #include "../../util/logging.hpp"
-#include "osx-private-key-storage.hpp"
-#include "../certificate/public-key.hpp"
+
+#include <ndn-cpp/security/identity/osx-private-key-storage.hpp>
+#include <ndn-cpp/security/certificate/public-key.hpp>
 
 #include <CoreFoundation/CoreFoundation.h>
 #include <Security/Security.h>
diff --git a/src/security/key-chain.cpp b/src/security/key-chain.cpp
index 47db4c1..ee56f8c 100644
--- a/src/security/key-chain.cpp
+++ b/src/security/key-chain.cpp
@@ -10,12 +10,12 @@
 
 #include <ndn-cpp/security/policy/policy-manager.hpp>
 
-#include "identity/basic-identity-storage.hpp"
+#include <ndn-cpp/security/identity/basic-identity-storage.hpp>
 
 
 using namespace std;
 using namespace ndn::func_lib;
-#if NDN_CPP_HAVE_STD_FUNCTION
+#if NDN_CPP_HAVE_CXX11
 // In the std library, the placeholders are in a different namespace than boost.
 using namespace ndn::func_lib::placeholders;
 #endif
diff --git a/src/security/security-exception.cpp b/src/security/security-exception.cpp
deleted file mode 100644
index b4acfad..0000000
--- a/src/security/security-exception.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Yingdi Yu <yingdi@cs.ucla.edu>
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#include <ndn-cpp/security/security-exception.hpp>
-using namespace std;
-
-namespace ndn {
-
-SecurityException::SecurityException(const string& errorMessage) throw()
-: errorMessage_(errorMessage)
-{
-}
-
-SecurityException::~SecurityException() throw()
-{
-}
-
-}
diff --git a/src/security/signature/sha256-with-rsa-handler.cpp b/src/security/signature/sha256-with-rsa-handler.cpp
deleted file mode 100644
index 1da748e..0000000
--- a/src/security/signature/sha256-with-rsa-handler.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Yingdi Yu <yingdi@cs.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#include "../../c/util/crypto.h"
-#include <ndn-cpp/sha256-with-rsa-signature.hpp>
-#include <ndn-cpp/security/security-exception.hpp>
-#include <ndn-cpp/security/signature/sha256-with-rsa-handler.hpp>
-
-using namespace std;
-
-namespace ndn {
-
-bool
-Sha256WithRsaHandler::verifySignature(const Data& data, const PublicKey& publicKey)
-{
-  const Sha256WithRsaSignature *signature = dynamic_cast<const Sha256WithRsaSignature*>(data.getSignature());
-  if (!signature)
-    throw SecurityException("signature is not Sha256WithRsaSignature.");
-  
-  // Set the data packet's default wire encoding if it is not already there.
-  if (signature->getDigestAlgorithm().size() != 0)
-    // TODO: Allow a non-default digest algorithm.
-    throw UnrecognizedDigestAlgorithmException("Cannot verify a data packet with a non-default digest algorithm.");
-  if (!data.getDefaultWireEncoding())
-    data.wireEncode();
-  
-  // Set signedPortionDigest to the digest of the signed portion of the wire encoding.
-  uint8_t signedPortionDigest[SHA256_DIGEST_LENGTH];
-  ndn_digestSha256(data.getDefaultWireEncoding().signedBuf(), data.getDefaultWireEncoding().signedSize(), signedPortionDigest);
-  
-  // Verify the signedPortionDigest.
-  // Use a temporary pointer since d2i updates it.
-  const uint8_t *derPointer = publicKey.getKeyDer().buf();
-  RSA *rsaPublicKey = d2i_RSA_PUBKEY(NULL, &derPointer, publicKey.getKeyDer().size());
-  if (!rsaPublicKey)
-    throw UnrecognizedKeyFormatException("Error decoding public key in d2i_RSAPublicKey");
-  int success = RSA_verify
-    (NID_sha256, signedPortionDigest, sizeof(signedPortionDigest), (uint8_t *)signature->getSignature().buf(),
-     signature->getSignature().size(), rsaPublicKey);
-  // Free the public key before checking for success.
-  RSA_free(rsaPublicKey);
-  
-  // RSA_verify returns 1 for a valid signature.
-  return (success == 1);
-}
-
-}