In all .cpp files, remove using namespace ndn::ptr_lib and explicitly use ptr_lib::shared_ptr and make_shared.
diff --git a/src/security/identity/basic-identity-storage.cpp b/src/security/identity/basic-identity-storage.cpp
index 85af9a9..46a98bf 100644
--- a/src/security/identity/basic-identity-storage.cpp
+++ b/src/security/identity/basic-identity-storage.cpp
@@ -26,7 +26,6 @@
INIT_LOGGER("BasicIdentityStorage");
using namespace std;
-using namespace ndn::ptr_lib;
namespace ndn
{
@@ -445,7 +444,7 @@
sqlite3_finalize(statement);
}
-shared_ptr<Data>
+ptr_lib::shared_ptr<Data>
BasicIdentityStorage::getCertificate(const Name &certificateName, bool allowAny)
{
if (doesCertificateExist(certificateName)) {
@@ -469,7 +468,7 @@
int res = sqlite3_step(statement);
- shared_ptr<Data> data(new Data());
+ ptr_lib::shared_ptr<Data> data(new Data());
if (res == SQLITE_ROW)
data->wireDecode((const uint8_t*)sqlite3_column_blob(statement, 0), sqlite3_column_bytes(statement, 0));
@@ -479,7 +478,7 @@
}
else {
_LOG_DEBUG("Certificate does not exist!");
- return shared_ptr<Data>();
+ return ptr_lib::shared_ptr<Data>();
}
}
diff --git a/src/security/identity/identity-manager.cpp b/src/security/identity/identity-manager.cpp
index 28e1d10..88e6782 100644
--- a/src/security/identity/identity-manager.cpp
+++ b/src/security/identity/identity-manager.cpp
@@ -26,7 +26,6 @@
INIT_LOGGER("ndn.security.IdentityManager")
using namespace std;
-using namespace ndn::ptr_lib;
namespace ndn {
@@ -41,7 +40,7 @@
Name keyName = generateRSAKeyPairAsDefault(identityName, true);
_LOG_DEBUG("Create self-signed certificate");
- shared_ptr<IdentityCertificate> selfCert = selfSign(keyName);
+ ptr_lib::shared_ptr<IdentityCertificate> selfCert = selfSign(keyName);
_LOG_DEBUG("Add self-signed certificate as default");
@@ -63,7 +62,7 @@
privateKeyStorage_->generateKeyPair(keyName.toUri(), keyType, keySize);
_LOG_DEBUG("Create a key record in public storage");
- shared_ptr<PublicKey> pubKey = privateKeyStorage_->getPublicKey(keyName.toUri());
+ ptr_lib::shared_ptr<PublicKey> pubKey = privateKeyStorage_->getPublicKey(keyName.toUri());
identityStorage_->addKey(keyName, keyType, pubKey->getKeyDer());
return keyName;
@@ -96,9 +95,9 @@
Name keyName = getKeyNameFromCertificatePrefix(certificatePrefix);
Blob keyBlob = identityStorage_->getKey(keyName);
- shared_ptr<PublicKey> publicKey = PublicKey::fromDer(keyBlob);
+ ptr_lib::shared_ptr<PublicKey> publicKey = PublicKey::fromDer(keyBlob);
- shared_ptr<IdentityCertificate> certificate = createIdentityCertificate
+ ptr_lib::shared_ptr<IdentityCertificate> certificate = createIdentityCertificate
(certificatePrefix, *publicKey, signerCertificateName, notBefore, notAfter);
identityStorage_->addCertificate(*certificate);
@@ -113,7 +112,7 @@
const MillisecondsSince1970& notBefore,
const MillisecondsSince1970& notAfter)
{
- shared_ptr<IdentityCertificate> certificate(new IdentityCertificate());
+ ptr_lib::shared_ptr<IdentityCertificate> certificate(new IdentityCertificate());
Name keyName = getKeyNameFromCertificatePrefix(certificatePrefix);
Name certificateName = certificatePrefix;
@@ -131,7 +130,7 @@
certificate->addSubjectDescription(CertificateSubjectDescription("2.5.4.41", keyName.toUri()));
certificate->encode();
- shared_ptr<Sha256WithRsaSignature> sha256Sig(new Sha256WithRsaSignature());
+ ptr_lib::shared_ptr<Sha256WithRsaSignature> sha256Sig(new Sha256WithRsaSignature());
KeyLocator keyLocator;
keyLocator.setType(ndn_KeyLocatorType_KEYNAME);
@@ -144,7 +143,7 @@
SignedBlob unsignedData = certificate->wireEncode();
- shared_ptr<IdentityCertificate> signerCertificate = getCertificate(signerCertificateName);
+ ptr_lib::shared_ptr<IdentityCertificate> signerCertificate = getCertificate(signerCertificateName);
Name signerkeyName = signerCertificate->getPublicKeyName();
Blob sigBits = privateKeyStorage_->sign(unsignedData, signerkeyName);
@@ -189,12 +188,12 @@
IdentityManager::signByCertificate(const uint8_t* buffer, size_t bufferLength, const Name& certificateName)
{
Name keyName = IdentityCertificate::certificateNameToPublicKeyName(certificateName);
- shared_ptr<PublicKey> publicKey = privateKeyStorage_->getPublicKey(keyName.toUri());
+ ptr_lib::shared_ptr<PublicKey> publicKey = privateKeyStorage_->getPublicKey(keyName.toUri());
Blob sigBits = privateKeyStorage_->sign(buffer, bufferLength, keyName.toUri());
//For temporary usage, we support RSA + SHA256 only, but will support more.
- shared_ptr<Sha256WithRsaSignature> sha256Sig(new Sha256WithRsaSignature());
+ ptr_lib::shared_ptr<Sha256WithRsaSignature> sha256Sig(new Sha256WithRsaSignature());
KeyLocator keyLocator;
keyLocator.setType(ndn_KeyLocatorType_KEYNAME);
@@ -211,7 +210,7 @@
IdentityManager::signByCertificate(Data &data, const Name &certificateName, WireFormat& wireFormat)
{
Name keyName = IdentityCertificate::certificateNameToPublicKeyName(certificateName);
- shared_ptr<PublicKey> publicKey = privateKeyStorage_->getPublicKey(keyName);
+ ptr_lib::shared_ptr<PublicKey> publicKey = privateKeyStorage_->getPublicKey(keyName);
// For temporary usage, we support RSA + SHA256 only, but will support more.
data.setSignature(Sha256WithRsaSignature());
@@ -236,17 +235,17 @@
data.wireEncode(wireFormat);
}
-shared_ptr<IdentityCertificate>
+ptr_lib::shared_ptr<IdentityCertificate>
IdentityManager::selfSign(const Name& keyName)
{
- shared_ptr<IdentityCertificate> certificate(new IdentityCertificate());
+ ptr_lib::shared_ptr<IdentityCertificate> certificate(new IdentityCertificate());
Name certificateName = keyName.getSubName(0, keyName.size() - 1);
certificateName.append("KEY").append(keyName.get(keyName.size() - 1)).append("ID-CERT").append("0");
certificate->setName(certificateName);
Blob keyBlob = identityStorage_->getKey(keyName);
- shared_ptr<PublicKey> publicKey = PublicKey::fromDer(keyBlob);
+ ptr_lib::shared_ptr<PublicKey> publicKey = PublicKey::fromDer(keyBlob);
#if NDN_CPP_HAVE_GMTIME_SUPPORT
time_t nowSeconds = time(NULL);
@@ -268,7 +267,7 @@
certificate->addSubjectDescription(CertificateSubjectDescription("2.5.4.41", keyName.toUri()));
certificate->encode();
- shared_ptr<Sha256WithRsaSignature> sha256Sig(new Sha256WithRsaSignature());
+ ptr_lib::shared_ptr<Sha256WithRsaSignature> sha256Sig(new Sha256WithRsaSignature());
KeyLocator keyLocator;
keyLocator.setType(ndn_KeyLocatorType_KEYNAME);
diff --git a/src/security/identity/memory-identity-storage.cpp b/src/security/identity/memory-identity-storage.cpp
index c5fb409..26341fa 100644
--- a/src/security/identity/memory-identity-storage.cpp
+++ b/src/security/identity/memory-identity-storage.cpp
@@ -14,7 +14,6 @@
#include <ndn-cpp/security/identity/memory-identity-storage.hpp>
using namespace std;
-using namespace ndn::ptr_lib;
namespace ndn {
@@ -64,13 +63,13 @@
if (doesKeyExist(keyName))
throw SecurityException("a key with the same name already exists!");
- keyStore_[keyName.toUri()] = make_shared<KeyRecord>(keyType, publicKeyDer);
+ keyStore_[keyName.toUri()] = ptr_lib::make_shared<KeyRecord>(keyType, publicKeyDer);
}
Blob
MemoryIdentityStorage::getKey(const Name& keyName)
{
- map<string, shared_ptr<KeyRecord> >::iterator record = keyStore_.find(keyName.toUri());
+ map<string, ptr_lib::shared_ptr<KeyRecord> >::iterator record = keyStore_.find(keyName.toUri());
if (record == keyStore_.end())
// Not found. Silently return null.
return Blob();
@@ -130,9 +129,9 @@
map<string, Blob>::iterator record = certificateStore_.find(certificateName.toUri());
if (record == certificateStore_.end())
// Not found. Silently return null.
- return shared_ptr<Data>();
+ return ptr_lib::shared_ptr<Data>();
- shared_ptr<Data> data(new Data());
+ ptr_lib::shared_ptr<Data> data(new Data());
data->wireDecode(*record->second);
return data;
}
diff --git a/src/security/identity/memory-private-key-storage.cpp b/src/security/identity/memory-private-key-storage.cpp
index b2bbcb5..7c3a2e0 100644
--- a/src/security/identity/memory-private-key-storage.cpp
+++ b/src/security/identity/memory-private-key-storage.cpp
@@ -13,7 +13,6 @@
#include <ndn-cpp/security/identity/memory-private-key-storage.hpp>
using namespace std;
-using namespace ndn::ptr_lib;
namespace ndn {
@@ -26,7 +25,7 @@
size_t privateKeyDerLength)
{
publicKeyStore_[keyName.toUri()] = PublicKey::fromDer(Blob(publicKeyDer, publicKeyDerLength));
- privateKeyStore_[keyName.toUri()] = make_shared<RsaPrivateKey>(privateKeyDer, privateKeyDerLength);
+ privateKeyStore_[keyName.toUri()] = ptr_lib::make_shared<RsaPrivateKey>(privateKeyDer, privateKeyDerLength);
}
void
@@ -37,10 +36,10 @@
#endif
}
-shared_ptr<PublicKey>
+ptr_lib::shared_ptr<PublicKey>
MemoryPrivateKeyStorage::getPublicKey(const Name& keyName)
{
- map<string, shared_ptr<PublicKey> >::iterator publicKey = publicKeyStore_.find(keyName.toUri());
+ map<string, ptr_lib::shared_ptr<PublicKey> >::iterator publicKey = publicKeyStore_.find(keyName.toUri());
if (publicKey == publicKeyStore_.end())
throw SecurityException(string("MemoryPrivateKeyStorage: Cannot find public key ") + keyName.toUri());
return publicKey->second;
@@ -59,7 +58,7 @@
unsigned int signatureBitsLength;
// Find the private key and sign.
- map<string, shared_ptr<RsaPrivateKey> >::iterator privateKey = privateKeyStore_.find(keyName.toUri());
+ map<string, ptr_lib::shared_ptr<RsaPrivateKey> >::iterator privateKey = privateKeyStore_.find(keyName.toUri());
if (privateKey == privateKeyStore_.end())
throw SecurityException(string("MemoryPrivateKeyStorage: Cannot find private key ") + keyName.toUri());
if (!RSA_sign(NID_sha256, digest, sizeof(digest), signatureBits, &signatureBitsLength, privateKey->second->getPrivateKey()))
diff --git a/src/security/identity/osx-private-key-storage.cpp b/src/security/identity/osx-private-key-storage.cpp
index aa6b7b8..e504616 100644
--- a/src/security/identity/osx-private-key-storage.cpp
+++ b/src/security/identity/osx-private-key-storage.cpp
@@ -18,7 +18,6 @@
#include <ndn-cpp/security/security-exception.hpp>
using namespace std;
-using namespace ndn::ptr_lib;
INIT_LOGGER("ndn.OSXPrivateKeyStorage");
@@ -124,7 +123,7 @@
throw SecurityException("Fail to create a symmetric key");
}
- shared_ptr<PublicKey> OSXPrivateKeyStorage::getPublicKey(const Name & keyName)
+ ptr_lib::shared_ptr<PublicKey> OSXPrivateKeyStorage::getPublicKey(const Name & keyName)
{
_LOG_TRACE("OSXPrivateKeyStorage::getPublickey");