diff --git a/js/WebSocketTransport.js b/js/WebSocketTransport.js
index f3ee4d9..6b65b37 100644
--- a/js/WebSocketTransport.js
+++ b/js/WebSocketTransport.js
@@ -151,7 +151,7 @@
 						// Key verification
 						var verified = false;
 						
-						// Recursive key fetching closure
+						// Recursive key fetching & verification closure
 						var KeyFetchClosure = function KeyFetchClosure(content, closure, key, signature) {
 							this.contentObject = content;  // unverified content object
 							this.closure = closure;  // closure corresponding to the contentObject
@@ -165,7 +165,7 @@
 							if (kind == Closure.UPCALL_INTEREST_TIMED_OUT) {
 								console.log("In KeyFetchClosure.upcall: interest time out.");
 							} else if (kind == Closure.UPCALL_CONTENT) {
-								console.log("In KeyFetchClosure.upcall");
+								console.log("In KeyFetchClosure.upcall: signature verification passed");
 								var keyHex = DataUtils.toHex(upcallInfo.contentObject.content).toLowerCase();
 								console.log("Key: " + keyHex);
 								
@@ -174,7 +174,7 @@
 								
 								var rsakey = new RSAKey();
 								rsakey.setPublic(kp, exp);
-								verified = rsakey.verifyByteArray(this.contentObject.rawSignatureData, sigHex);
+								var verified = rsakey.verifyByteArray(this.contentObject.rawSignatureData, this.signature);
 								var flag = (verified == true) ? Closure.UPCALL_CONTENT : Closure.UPCALL_CONTENT_BAD;
 								
 								console.log("raise encapsulated closure");
@@ -192,19 +192,51 @@
 								var keyname = keylocator.keyName.contentName.getName();
 								console.log(keyname);
 								
-								if (nameStr.match("/ccnx.org/Users/")) {
-									console.log("Key found");
-									currentClosure.upcall(Closure.UPCALL_CONTENT, new UpcallInfo(ndn, null, 0, co));
+								if (nameStr.match(keyname)) {
+									console.log("Content is key itself");
+									
+									var keyHex = DataUtils.toHex(co.content).toLowerCase();
+									console.log("Key content: " + keyHex);
+									
+									var kp = keyHex.slice(56, 314);
+									var exp = keyHex.slice(318, 324);
+									
+									var rsakey = new RSAKey();
+									rsakey.setPublic(kp, exp);
+									var verified = rsakey.verifyByteArray(co.rawSignatureData, sigHex);
+									var flag = (verified == true) ? Closure.UPCALL_CONTENT : Closure.UPCALL_CONTENT_BAD;
+									
+									currentClosure.upcall(flag, new UpcallInfo(ndn, null, 0, co));
+									
+									// Store key in cache
+									var keyEntry = new KeyStoreEntry(keylocator.keyName, keyHex, rsakey);
+									NDN.KeyStore.push(keyEntry);
 								} else {
 									console.log("Fetch key according to keylocator");
-									var nextClosure = new KeyFetchClosure(co, currentClosure, keyname, sigHex);
-									var interest = new Interest(keylocator.keyName.contentName.getPrefix(4));
-									interest.interestLifetime = 4.0;
-									self.expressInterest(ndn, interest, nextClosure);
+									
+									// Check local key store
+									var keyEntry = NDN.getKeyByName(keylocator.keyName);
+									if (keyEntry) {
+										// Key found, verify now
+										console.log("Local key cache hit");
+										var rsakey = keyEntry.rsaKey;
+										verified = rsakey.verifyByteArray(co.rawSignatureData, sigHex);
+										
+										var flag = (verified == true) ? Closure.UPCALL_CONTENT : Closure.UPCALL_CONTENT_BAD;
+										
+										// Raise callback
+										currentClosure.upcall(Closure.UPCALL_CONTENT, new UpcallInfo(ndn, null, 0, co));
+									} else {
+										// Not found, fetch now
+										var nextClosure = new KeyFetchClosure(co, currentClosure, keyname, sigHex);
+										var interest = new Interest(keylocator.keyName.contentName.getPrefix(4));
+										interest.interestLifetime = 4.0;
+										self.expressInterest(ndn, interest, nextClosure);
+									}
 								}
 							} else if (keylocator.type == KeyLocatorType.KEY) {
 								console.log("Keylocator contains KEY");
-								var publickeyHex = DataUtils.toHex(co.signedInfo.locator.publicKey).toLowerCase();
+								var publickeyHex = DataUtils.toHex(keylocator.publicKey).toLowerCase();
 								console.log(publickeyHex);
 		
 								var kp = publickeyHex.slice(56, 314);
@@ -218,6 +250,10 @@
 								
 								// Raise callback
 								currentClosure.upcall(Closure.UPCALL_CONTENT, new UpcallInfo(ndn, null, 0, co));
+								
+								// Store key in cache
+								var keyEntry = new KeyStoreEntry(keylocator.keyName, publickeyHex, rsakey);
+								NDN.KeyStore.push(keyEntry);
 							} else {
 								var cert = keylocator.certificate;
 								console.log("KeyLocator contains CERT");
