Change to use openssl/evp.h
diff --git a/ndn-cpp/key-chain.cpp b/ndn-cpp/key-chain.cpp
index d195b6f..6d4bc46 100644
--- a/ndn-cpp/key-chain.cpp
+++ b/ndn-cpp/key-chain.cpp
@@ -4,7 +4,7 @@
  */
 
 #include <stdexcept>
-#include <openssl/ssl.h>
+#include <openssl/evp.h>
 #include "c/encoding/binary-xml-data.h"
 #include "encoding/binary-xml-encoder.hpp"
 #include "key-chain.hpp"
@@ -25,7 +25,15 @@
 0x00, 01  
 };
 
-#if 0
+static bool CryptoIsEstablished = false;
+static void establishCrypto()
+{
+  if (!CryptoIsEstablished) {
+    CryptoIsEstablished = true;
+    OpenSSL_add_all_digests();
+  }
+}
+
 /**
  * Set digest to the sha-256 digest of data
  * @param data Pointer to the input byte array.
@@ -34,12 +42,18 @@
  */
 static void setSha256(unsigned char *data, unsigned int dataLength, vector<unsigned char> &digest)
 {
-  unsigned char digestBuffer[SHA256_DIGEST_LENGTH];
-  SHA256_CTX sha256;
-  SHA256_Init(&sha256);
-  SHA256_Update(&sha256, data, dataLength);
-  SHA256_Final(digestBuffer, &sha256);
-  setVector(digest, digestBuffer, sizeof(digestBuffer));
+  establishCrypto();
+  
+  EVP_MD_CTX *context = EVP_MD_CTX_create();
+  EVP_DigestInit_ex(context, EVP_get_digestbyname("SHA256"), NULL);
+  EVP_DigestUpdate(context, data, dataLength);
+  
+  unsigned char digestBuffer[EVP_MAX_MD_SIZE];
+  unsigned int digestLength;
+  EVP_DigestFinal_ex(context, digestBuffer, &digestLength);
+  EVP_MD_CTX_destroy(context);
+
+  setVector(digest, digestBuffer, digestLength);
 }
 
 /**
@@ -78,12 +92,13 @@
   // TODO: use RSA_size to get the proper size of the signature buffer.
   unsigned char signature[1000];
   unsigned int signatureLength;
+#if 0
   RSA *privateKey;
   if (!RSA_sign(NID_sha256, &dataFieldsDigest[0], dataFieldsDigest.size(), signature, &signatureLength, privateKey))
     throw std::runtime_error("Errir in RSA_sign");
   
   data.getSignature().setSignature(signature, signatureLength);
-}
 #endif
+}
 
 }
diff --git a/tests/test-encode-decode-data.cpp b/tests/test-encode-decode-data.cpp
index 2164eb4..559aa60 100644
--- a/tests/test-encode-decode-data.cpp
+++ b/tests/test-encode-decode-data.cpp
@@ -12,6 +12,7 @@
 #include <boost/date_time/gregorian/gregorian.hpp>
 #endif
 #include <ndn-cpp/data.hpp>
+#include <ndn-cpp/key-chain.hpp>
 
 using namespace std;
 using namespace ndn;
@@ -93,7 +94,12 @@
   cout << "signedInfo.publisherPublicKeyDigest: "
        << (data.getSignedInfo().getPublisherPublicKeyDigest().getPublisherPublicKeyDigest().size() > 0 ? 
            toHex(data.getSignedInfo().getPublisherPublicKeyDigest().getPublisherPublicKeyDigest()).c_str() : "<none>") << endl;
-  // TODO: dump timestamp.
+  cout << "signedInfo.timestamp: ";
+  if (data.getSignedInfo().getTimestampMilliseconds() >= 0)
+    cout << data.getSignedInfo().getTimestampMilliseconds() << " milliseconds" << endl;
+    // TODO: dump timestamp real date.
+  else
+    cout << "<none>" << endl;
   cout << "signedInfo.freshnessSeconds: ";
   if (data.getSignedInfo().getFreshnessSeconds() >= 0)
     cout << data.getSignedInfo().getFreshnessSeconds() << endl;
@@ -137,6 +143,14 @@
     reDecodedData.wireDecode(*encoding);
     cout << endl << "Re-decoded Data:" << endl;
     dumpData(reDecodedData);
+  
+    Data freshData(Name("/ndn/abc"));
+    const char *freshContent = "SUCCESS!";
+    freshData.setContent((const unsigned char *)freshContent, strlen(freshContent));
+    
+    KeyChain::defaultSign(freshData);
+    cout << endl << "Freshly signed data:" << endl;
+    dumpData(freshData);
   } catch (exception &e) {
     cout << "exception: " << e.what() << endl;
   }