Small bug in contentObjectToHTML() fixed
diff --git a/js/WebSocketTransport.js b/js/WebSocketTransport.js
index 7a06f1e..a7be7f9 100644
--- a/js/WebSocketTransport.js
+++ b/js/WebSocketTransport.js
@@ -78,8 +78,8 @@
var interest = new Interest();
interest.from_ccnb(decoder);
if (LOG > 3) console.log(interest);
- //var nameStr = escape(interest.name.getName());
- //console.log(nameStr);
+ var nameStr = escape(interest.name.getName());
+ if (LOG > 3) console.log(nameStr);
var entry = getEntryForRegisteredPrefix(nameStr);
if (entry != null) {
@@ -107,14 +107,9 @@
var co = new ContentObject();
co.from_ccnb(decoder);
- if (LOG > 3) console.log(co);
+ //console.log(co);
//var nameStr = co.name.getName();
//console.log(nameStr);
- var wit = null;
- if (co.signature.Witness != null) {
- wit = new Witness();
- wit.decode(co.signature.Witness);
- }
if (self.ccndid == null && NDN.ccndIdFetcher.match(co.name)) {
// We are in starting phase, record publisherPublicKeyDigest in self.ccndid
@@ -170,7 +165,7 @@
console.log("In KeyFetchClosure.upcall: interest time out.");
console.log(this.keyName.contentName.getName());
} else if (kind == Closure.UPCALL_CONTENT) {
- if (LOG > 3) console.log("In KeyFetchClosure.upcall: signature verification passed");
+ //console.log("In KeyFetchClosure.upcall: signature verification passed");
var rsakey = decodeSubjectPublicKeyInfo(upcallInfo.contentObject.content);
var verified = rsakey.verifyByteArray(this.contentObject.rawSignatureData, this.witness, this.sigHex);
@@ -183,6 +178,8 @@
var keyEntry = new KeyStoreEntry(keylocator.keyName, rsakey, new Date().getTime());
NDN.addKeyEntry(keyEntry);
//console.log(NDN.KeyStore);
+ } else if (kind == Closure.UPCALL_CONTENT_BAD) {
+ console.log("In KeyFetchClosure.upcall: signature verification failed");
}
};
@@ -190,6 +187,12 @@
if (LOG > 3) console.log("Key verification...");
var sigHex = DataUtils.toHex(co.signature.signature).toLowerCase();
+ var wit = null;
+ if (co.signature.Witness != null) {
+ wit = new Witness();
+ wit.decode(co.signature.Witness);
+ }
+
var keylocator = co.signedInfo.locator;
if (keylocator.type == KeyLocatorType.KEYNAME) {
if (LOG > 3) console.log("KeyLocator contains KEYNAME");
@@ -234,14 +237,9 @@
}
} else if (keylocator.type == KeyLocatorType.KEY) {
if (LOG > 3) console.log("Keylocator contains KEY");
- var verified = false;
- if (wit == null) {
- var rsakey = decodeSubjectPublicKeyInfo(co.signedInfo.locator.publicKey);
- verified = rsakey.verifyByteArray(co.rawSignatureData, wit, sigHex);
- } else {
-
- }
+ var rsakey = decodeSubjectPublicKeyInfo(co.signedInfo.locator.publicKey);
+ var verified = rsakey.verifyByteArray(co.rawSignatureData, wit, sigHex);
var flag = (verified == true) ? Closure.UPCALL_CONTENT : Closure.UPCALL_CONTENT_BAD;
// Raise callback