diff --git a/src/security/identity-certificate.cpp b/src/security/identity-certificate.cpp
index 33e1e71..b3c544a 100644
--- a/src/security/identity-certificate.cpp
+++ b/src/security/identity-certificate.cpp
@@ -26,7 +26,7 @@
   string idString("ID-CERT");
   int i = name.size() - 1;
   for (; i >= 0; i--) {
-    if (name.get(i).toEscapedString() == idString)
+    if (name.get(i).toUri() == idString)
       break;
   }
 
@@ -36,7 +36,7 @@
   string keyString("KEY");
   size_t keyIndex = 0;
   for (; keyIndex < name.size(); keyIndex++) {
-    if (name.get(keyIndex).toEscapedString() == keyString)
+    if (name.get(keyIndex).toUri() == keyString)
       break;
   }
 
@@ -68,7 +68,7 @@
   bool foundIdString = false;
   size_t idCertComponentIndex = certificateName.size() - 1;
   for (; idCertComponentIndex + 1 > 0; --idCertComponentIndex) {
-    if (certificateName.get(idCertComponentIndex).toEscapedString() == idString)
+    if (certificateName.get(idCertComponentIndex).toUri() == idString)
       {
         foundIdString = true;
         break;
@@ -83,7 +83,7 @@
   bool foundKeyString = false;
   size_t keyComponentIndex = 0;
   for (; keyComponentIndex < tmpName.size(); keyComponentIndex++) {
-    if (tmpName.get(keyComponentIndex).toEscapedString() == keyString)
+    if (tmpName.get(keyComponentIndex).toUri() == keyString)
       {
         foundKeyString = true;
         break;
diff --git a/src/security/key-chain.cpp b/src/security/key-chain.cpp
index 67cdda6..18051c1 100644
--- a/src/security/key-chain.cpp
+++ b/src/security/key-chain.cpp
@@ -116,7 +116,7 @@
   if (keyName.size() < 1)
     return shared_ptr<IdentityCertificate>();
 
-  std::string keyIdPrefix = keyName.get(-1).toEscapedString().substr(0, 4);
+  std::string keyIdPrefix = keyName.get(-1).toUri().substr(0, 4);
   if (keyIdPrefix != "ksk-" && keyIdPrefix != "dsk-")
     return shared_ptr<IdentityCertificate>();
 
diff --git a/src/security/sec-public-info-sqlite3.cpp b/src/security/sec-public-info-sqlite3.cpp
index 7f248d5..86256f8 100644
--- a/src/security/sec-public-info-sqlite3.cpp
+++ b/src/security/sec-public-info-sqlite3.cpp
@@ -233,7 +233,7 @@
   if (keyName.empty())
     throw Error("Incorrect key name " + keyName.toUri());
 
-  string keyId = keyName.get(-1).toEscapedString();
+  string keyId = keyName.get(-1).toUri();
   Name identityName = keyName.getPrefix(-1);
 
   sqlite3_stmt* statement;
@@ -269,7 +269,7 @@
   if (doesPublicKeyExist(keyName))
     return;
 
-  string keyId = keyName.get(-1).toEscapedString();
+  string keyId = keyName.get(-1).toUri();
   Name identityName = keyName.getPrefix(-1);
 
   addIdentity(identityName);
@@ -302,7 +302,7 @@
       throw Error("SecPublicInfoSqlite3::getPublicKey  Empty keyName");
     }
 
-  string keyId = keyName.get(-1).toEscapedString();
+  string keyId = keyName.get(-1).toUri();
   Name identityName = keyName.getPrefix(-1);
 
   sqlite3_stmt* statement;
@@ -364,7 +364,7 @@
 //   if (keyName.empty())
 //     return;
 
-//   std::string keyId = keyName.get(-1).toEscapedString();
+//   std::string keyId = keyName.get(-1).toUri();
 //   std::string identityName = keyName.getPrefix(-1).toUri();
 
 //   sqlite3_stmt* statement;
@@ -421,7 +421,7 @@
   if (doesCertificateExist(certificateName))
     return;
 
-  string keyId = keyName.get(-1).toEscapedString();
+  string keyId = keyName.get(-1).toUri();
   Name identity = keyName.getPrefix(-1);
 
   // Insert the certificate
@@ -585,7 +585,7 @@
   if (!doesPublicKeyExist(keyName))
     throw Error("Key does not exist:" + keyName.toUri());
 
-  string keyId = keyName.get(-1).toEscapedString();
+  string keyId = keyName.get(-1).toUri();
   Name identityName = keyName.getPrefix(-1);
 
   sqlite3_stmt* statement;
@@ -622,7 +622,7 @@
   if (keyName.empty())
     throw Error("SecPublicInfoSqlite3::getDefaultCertificateNameForKey wrong key");
 
-  string keyId = keyName.get(-1).toEscapedString();
+  string keyId = keyName.get(-1).toUri();
   Name identityName = keyName.getPrefix(-1);
 
   sqlite3_stmt* statement;
@@ -657,7 +657,7 @@
     throw Error("certificate does not exist:" + certificateName.toUri());
 
   Name keyName = IdentityCertificate::certificateNameToPublicKeyName(certificateName);
-  string keyId = keyName.get(-1).toEscapedString();
+  string keyId = keyName.get(-1).toUri();
   Name identityName = keyName.getPrefix(-1);
 
   sqlite3_stmt* statement;
@@ -812,7 +812,7 @@
   Name identity = keyName.getPrefix(-1);
   sqlite3_bind_text(stmt, 1, identity.toUri().c_str(), identity.toUri().size (), SQLITE_TRANSIENT);
 
-  std::string baseKeyName = keyName.get(-1).toEscapedString();
+  std::string baseKeyName = keyName.get(-1).toUri();
   sqlite3_bind_text(stmt, 2, baseKeyName.c_str(), baseKeyName.size(), SQLITE_TRANSIENT);
 
   while (sqlite3_step(stmt) == SQLITE_ROW)
@@ -842,7 +842,7 @@
     return;
 
   string identity = keyName.getPrefix(-1).toUri();
-  string keyId = keyName.get(-1).toEscapedString();
+  string keyId = keyName.get(-1).toUri();
 
   sqlite3_stmt* stmt;
   sqlite3_prepare_v2(m_database,
