Moved classes Signature and SignedInfo into ContentObject.js, and deleted Signature.js and SignedInfo.js.
Moved classes Exclude, ExcludeAny and ExcludeComponent into Interest.js, and deleted Exclude.js, ExcludeAny.js and ExcludeComponent.js.
diff --git a/js/ContentObject.js b/js/ContentObject.js
index 8caa2df..941f032 100644
--- a/js/ContentObject.js
+++ b/js/ContentObject.js
@@ -172,3 +172,276 @@
};
ContentObject.prototype.getElementLabel= function(){return CCNProtocolDTags.ContentObject;};
+
+/**
+ * Signature
+ */
+var Signature = function Signature(_witness,_signature,_digestAlgorithm) {
+
+ this.Witness = _witness;//byte [] _witness;
+ this.signature = _signature;//byte [] _signature;
+ this.digestAlgorithm = _digestAlgorithm//String _digestAlgorithm;
+};
+
+var generateSignature = function(contentName,content,signedinfo){
+
+ var enc = new BinaryXMLEncoder();
+ contentName.to_ccnb(enc);
+ var hex1 = toHex(enc.getReducedOstream());
+
+ var enc = new BinaryXMLEncoder();
+ content.to_ccnb(enc);
+ var hex2 = toHex(enc.getReducedOstream());
+
+ var enc = new BinaryXMLEncoder();
+ signedinfo.to_ccnb(enc);
+ var hex3 = toHex(enc.getReducedOstream());
+
+ var hex = hex1+hex2+hex3;
+
+ //globalKeyManager.sig
+
+};
+
+Signature.prototype.from_ccnb =function( decoder) {
+ decoder.readStartElement(this.getElementLabel());
+
+ if(LOG>4)console.log('STARTED DECODING SIGNATURE ');
+
+ if (decoder.peekStartElement(CCNProtocolDTags.DigestAlgorithm)) {
+
+ if(LOG>4)console.log('DIGIEST ALGORITHM FOUND');
+ this.digestAlgorithm = decoder.readUTF8Element(CCNProtocolDTags.DigestAlgorithm);
+ }
+ if (decoder.peekStartElement(CCNProtocolDTags.Witness)) {
+ if(LOG>4)console.log('WITNESS FOUND FOUND');
+ this.Witness = decoder.readBinaryElement(CCNProtocolDTags.Witness);
+ }
+
+ //FORCE TO READ A SIGNATURE
+
+ //if(LOG>4)console.log('SIGNATURE FOUND ');
+ this.signature = decoder.readBinaryElement(CCNProtocolDTags.SignatureBits);
+ if(LOG>4)console.log('READ SIGNATURE ');
+
+ decoder.readEndElement();
+
+};
+
+
+Signature.prototype.to_ccnb= function( encoder){
+
+ if (!this.validate()) {
+ throw new Error("Cannot encode: field values missing.");
+ }
+
+ encoder.writeStartElement(this.getElementLabel());
+
+ if ((null != this.digestAlgorithm) && (!this.digestAlgorithm.equals(CCNDigestHelper.DEFAULT_DIGEST_ALGORITHM))) {
+ encoder.writeElement(CCNProtocolDTags.DigestAlgorithm, OIDLookup.getDigestOID(this.DigestAlgorithm));
+ }
+
+ if (null != this.Witness) {
+ // needs to handle null witness
+ encoder.writeElement(CCNProtocolDTags.Witness, this.Witness);
+ }
+
+ encoder.writeElement(CCNProtocolDTags.SignatureBits, this.signature);
+
+ encoder.writeEndElement();
+};
+
+Signature.prototype.getElementLabel = function() { return CCNProtocolDTags.Signature; };
+
+
+Signature.prototype.validate = function() {
+ return null != this.signature;
+};
+
+
+/**
+ * SignedInfo
+ */
+var ContentType = {DATA:0, ENCR:1, GONE:2, KEY:3, LINK:4, NACK:5};
+var ContentTypeValue = {0:0x0C04C0, 1:0x10D091,2:0x18E344,3:0x28463F,4:0x2C834A,5:0x34008A};
+var ContentTypeValueReverse = {0x0C04C0:0, 0x10D091:1,0x18E344:2,0x28463F:3,0x2C834A:4,0x34008A:5};
+
+var SignedInfo = function SignedInfo(_publisher,_timestamp,_type,_locator,_freshnessSeconds,_finalBlockID){
+
+ //TODO, Check types
+
+ this.publisher = _publisher; //publisherPublicKeyDigest
+ this.timestamp=_timestamp; // CCN Time
+ this.type=_type; // ContentType
+ this.locator =_locator;//KeyLocator
+ this.freshnessSeconds =_freshnessSeconds; // Integer
+ this.finalBlockID=_finalBlockID; //byte array
+
+};
+
+SignedInfo.prototype.setFields = function(){
+ //BASE64 -> RAW STRING
+
+ //this.locator = new KeyLocator( DataUtils.toNumbersFromString(stringCertificate) ,KeyLocatorType.CERTIFICATE );
+
+ var publicKeyHex = globalKeyManager.publicKey;
+
+ console.log('PUBLIC KEY TO WRITE TO CONTENT OBJECT IS ');
+ console.log(publicKeyHex);
+
+ var publicKeyBytes = DataUtils.toNumbers(globalKeyManager.publicKey) ;
+
+
+
+ //var stringCertificate = DataUtils.base64toString(globalKeyManager.certificate);
+
+ //if(LOG>3)console.log('string Certificate is '+stringCertificate);
+
+ //HEX -> BYTE ARRAY
+ //var publisherkey = DataUtils.toNumbers(hex_sha256(stringCertificate));
+
+ //if(LOG>3)console.log('publisher key is ');
+ //if(LOG>3)console.log(publisherkey);
+
+ var publisherKeyDigest = hex_sha256_from_bytes(publicKeyBytes);
+
+ this.publisher = new PublisherPublicKeyDigest( DataUtils.toNumbers( publisherKeyDigest ) );
+
+ //this.publisher = new PublisherPublicKeyDigest(publisherkey);
+
+ var d = new Date();
+
+ var time = d.getTime();
+
+
+ this.timestamp = new CCNTime( time );
+
+ if(LOG>4)console.log('TIME msec is');
+
+ if(LOG>4)console.log(this.timestamp.msec);
+
+ //DATA
+ this.type = 0;//0x0C04C0;//ContentTypeValue[ContentType.DATA];
+
+ //if(LOG>4)console.log('toNumbersFromString(stringCertificate) '+DataUtils.toNumbersFromString(stringCertificate));
+
+ console.log('PUBLIC KEY TO WRITE TO CONTENT OBJECT IS ');
+ console.log(publicKeyBytes);
+
+ this.locator = new KeyLocator( publicKeyBytes ,KeyLocatorType.KEY );
+
+ //this.locator = new KeyLocator( DataUtils.toNumbersFromString(stringCertificate) ,KeyLocatorType.CERTIFICATE );
+
+};
+
+SignedInfo.prototype.from_ccnb = function( decoder){
+
+ decoder.readStartElement( this.getElementLabel() );
+
+ if (decoder.peekStartElement(CCNProtocolDTags.PublisherPublicKeyDigest)) {
+ if(LOG>3) console.log('DECODING PUBLISHER KEY');
+ this.publisher = new PublisherPublicKeyDigest();
+ this.publisher.from_ccnb(decoder);
+ }
+
+ if (decoder.peekStartElement(CCNProtocolDTags.Timestamp)) {
+ this.timestamp = decoder.readDateTime(CCNProtocolDTags.Timestamp);
+ if(LOG>4)console.log('TIMESTAMP FOUND IS '+this.timestamp);
+
+ }
+
+ if (decoder.peekStartElement(CCNProtocolDTags.Type)) {
+ binType = decoder.readBinaryElement(CCNProtocolDTags.Type);//byte []
+
+
+ //TODO Implement type of Key Reading
+
+ if(LOG>4)console.log('Binary Type of of Signed Info is '+binType);
+
+ this.type = binType;
+
+
+ //TODO Implement type of Key Reading
+
+
+ if (null == this.type) {
+ throw new Error("Cannot parse signedInfo type: bytes.");
+ }
+
+ } else {
+ this.type = ContentType.DATA; // default
+ }
+
+ if (decoder.peekStartElement(CCNProtocolDTags.FreshnessSeconds)) {
+ this.freshnessSeconds = decoder.readIntegerElement(CCNProtocolDTags.FreshnessSeconds);
+ if(LOG>4) console.log('FRESHNESS IN SECONDS IS '+ this.freshnessSeconds);
+ }
+
+ if (decoder.peekStartElement(CCNProtocolDTags.FinalBlockID)) {
+ this.finalBlockID = decoder.readBinaryElement(CCNProtocolDTags.FinalBlockID);
+ }
+
+ if (decoder.peekStartElement(CCNProtocolDTags.KeyLocator)) {
+ this.locator = new KeyLocator();
+ this.locator.from_ccnb(decoder);
+ }
+
+ decoder.readEndElement();
+};
+
+SignedInfo.prototype.to_ccnb = function( encoder) {
+ if (!this.validate()) {
+ throw new Error("Cannot encode : field values missing.");
+ }
+ encoder.writeStartElement(this.getElementLabel());
+
+ if (null!=this.publisher) {
+ if(LOG>3) console.log('ENCODING PUBLISHER KEY' + this.publisher.publisherPublicKeyDigest);
+
+ this.publisher.to_ccnb(encoder);
+ }
+
+ if (null!=this.timestamp) {
+ encoder.writeDateTime(CCNProtocolDTags.Timestamp, this.timestamp );
+ }
+
+ if (null!=this.type && this.type !=0) {
+
+ encoder.writeElement(CCNProtocolDTags.type, this.type);
+ }
+
+ if (null!=this.freshnessSeconds) {
+ encoder.writeElement(CCNProtocolDTags.FreshnessSeconds, this.freshnessSeconds);
+ }
+
+ if (null!=this.finalBlockID) {
+ encoder.writeElement(CCNProtocolDTags.FinalBlockID, this.finalBlockID);
+ }
+
+ if (null!=this.locator) {
+ this.locator.to_ccnb(encoder);
+ }
+
+ encoder.writeEndElement();
+};
+
+SignedInfo.prototype.valueToType = function(){
+ //for (Entry<byte [], ContentType> entry : ContentValueTypes.entrySet()) {
+ //if (Arrays.equals(value, entry.getKey()))
+ //return entry.getValue();
+ //}
+ return null;
+
+};
+
+SignedInfo.prototype.getElementLabel = function() {
+ return CCNProtocolDTags.SignedInfo;
+};
+
+SignedInfo.prototype.validate = function() {
+ // We don't do partial matches any more, even though encoder/decoder
+ // is still pretty generous.
+ if (null ==this.publisher || null==this.timestamp ||null== this.locator)
+ return false;
+ return true;
+};
diff --git a/js/Exclude.js b/js/Exclude.js
deleted file mode 100644
index 1ee9112..0000000
--- a/js/Exclude.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * @author: ucla-cs
- * This class represents Exclude objects
- */
-
-var Exclude = function Exclude(_values){
-
- this.OPTIMUM_FILTER_SIZE = 100;
-
-
- this.values = _values; //array of elements
-
-}
-
-Exclude.prototype.from_ccnb = function(/*XMLDecoder*/ decoder) {
-
-
-
- decoder.readStartElement(this.getElementLabel());
-
- //TODO APPLY FILTERS/EXCLUDE
-
- //TODO
- /*var component;
- var any = false;
- while ((component = decoder.peekStartElement(CCNProtocolDTags.Component)) ||
- (any = decoder.peekStartElement(CCNProtocolDTags.Any)) ||
- decoder.peekStartElement(CCNProtocolDTags.Bloom)) {
- var ee = component?new ExcludeComponent(): any ? new ExcludeAny() : new BloomFilter();
- ee.decode(decoder);
- _values.add(ee);
- }*/
-
- decoder.readEndElement();
-
-};
-
-Exclude.prototype.to_ccnb=function(/*XMLEncoder*/ encoder) {
- if (!validate()) {
- throw new ContentEncodingException("Cannot encode " + this.getClass().getName() + ": field values missing.");
- }
-
- if (empty())
- return;
-
- encoder.writeStartElement(getElementLabel());
-
- encoder.writeEndElement();
-
- };
-
-Exclude.prototype.getElementLabel = function() { return CCNProtocolDTags.Exclude; };
-
diff --git a/js/ExcludeAny.js b/js/ExcludeAny.js
deleted file mode 100644
index 7986cba..0000000
--- a/js/ExcludeAny.js
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * @author: ucla-cs
- * This class represents ExcludeAny objects
- */
-
-var ExcludeAny = function ExcludeAny() {
-
-};
-
-ExcludeAny.prototype.from_ccnb = function(decoder) {
- decoder.readStartElement(this.getElementLabel());
- decoder.readEndElement();
-};
-
-
-ExcludeAny.prototype.to_ccnb = function( encoder) {
- encoder.writeStartElement(this.getElementLabel());
- encoder.writeEndElement();
-};
-
-ExcludeAny.prototype.getElementLabel=function() { return CCNProtocolDTags.Any; };
diff --git a/js/ExcludeComponent.js b/js/ExcludeComponent.js
deleted file mode 100644
index d723d93..0000000
--- a/js/ExcludeComponent.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * @author: ucla-cs
- * This class represents Exclude Component OBjects
- */
-
-var ExcludeComponent = function ExcludeComponent(_body) {
-
- //TODO Check BODY is an Array of componenets.
-
- this.body = _body
-};
-
-ExcludeComponent.prototype.from_ccnb = function( decoder) {
- this.body = decoder.readBinaryElement(this.getElementLabel());
-};
-
-ExcludeComponent.prototype.to_ccnb = function(encoder) {
- encoder.writeElement(this.getElementLabel(), this.body);
-};
-
-ExcludeComponent.prototype.getElementLabel = function() { return CCNProtocolDTags.Component; };
-
diff --git a/js/Interest.js b/js/Interest.js
index 04cc290..a04c463 100644
--- a/js/Interest.js
+++ b/js/Interest.js
@@ -134,3 +134,95 @@
return true;
}
+/**
+ * Exclude
+ */
+var Exclude = function Exclude(_values){
+
+ this.OPTIMUM_FILTER_SIZE = 100;
+
+
+ this.values = _values; //array of elements
+
+}
+
+Exclude.prototype.from_ccnb = function(/*XMLDecoder*/ decoder) {
+
+
+
+ decoder.readStartElement(this.getElementLabel());
+
+ //TODO APPLY FILTERS/EXCLUDE
+
+ //TODO
+ /*var component;
+ var any = false;
+ while ((component = decoder.peekStartElement(CCNProtocolDTags.Component)) ||
+ (any = decoder.peekStartElement(CCNProtocolDTags.Any)) ||
+ decoder.peekStartElement(CCNProtocolDTags.Bloom)) {
+ var ee = component?new ExcludeComponent(): any ? new ExcludeAny() : new BloomFilter();
+ ee.decode(decoder);
+ _values.add(ee);
+ }*/
+
+ decoder.readEndElement();
+
+};
+
+Exclude.prototype.to_ccnb=function(/*XMLEncoder*/ encoder) {
+ if (!validate()) {
+ throw new ContentEncodingException("Cannot encode " + this.getClass().getName() + ": field values missing.");
+ }
+
+ if (empty())
+ return;
+
+ encoder.writeStartElement(getElementLabel());
+
+ encoder.writeEndElement();
+
+ };
+
+Exclude.prototype.getElementLabel = function() { return CCNProtocolDTags.Exclude; };
+
+
+/**
+ * ExcludeAny
+ */
+var ExcludeAny = function ExcludeAny() {
+
+};
+
+ExcludeAny.prototype.from_ccnb = function(decoder) {
+ decoder.readStartElement(this.getElementLabel());
+ decoder.readEndElement();
+};
+
+
+ExcludeAny.prototype.to_ccnb = function( encoder) {
+ encoder.writeStartElement(this.getElementLabel());
+ encoder.writeEndElement();
+};
+
+ExcludeAny.prototype.getElementLabel=function() { return CCNProtocolDTags.Any; };
+
+
+/**
+ * ExcludeComponent
+ */
+var ExcludeComponent = function ExcludeComponent(_body) {
+
+ //TODO Check BODY is an Array of componenets.
+
+ this.body = _body
+};
+
+ExcludeComponent.prototype.from_ccnb = function( decoder) {
+ this.body = decoder.readBinaryElement(this.getElementLabel());
+};
+
+ExcludeComponent.prototype.to_ccnb = function(encoder) {
+ encoder.writeElement(this.getElementLabel(), this.body);
+};
+
+ExcludeComponent.prototype.getElementLabel = function() { return CCNProtocolDTags.Component; };
diff --git a/js/Signature.js b/js/Signature.js
deleted file mode 100644
index 6b71dad..0000000
--- a/js/Signature.js
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * @author: ucla-cs
- * This class represents Signature Objects
- */
-
-
-var Signature = function Signature(_witness,_signature,_digestAlgorithm) {
-
- this.Witness = _witness;//byte [] _witness;
- this.signature = _signature;//byte [] _signature;
- this.digestAlgorithm = _digestAlgorithm//String _digestAlgorithm;
-};
-
-var generateSignature = function(contentName,content,signedinfo){
-
- var enc = new BinaryXMLEncoder();
- contentName.to_ccnb(enc);
- var hex1 = toHex(enc.getReducedOstream());
-
- var enc = new BinaryXMLEncoder();
- content.to_ccnb(enc);
- var hex2 = toHex(enc.getReducedOstream());
-
- var enc = new BinaryXMLEncoder();
- signedinfo.to_ccnb(enc);
- var hex3 = toHex(enc.getReducedOstream());
-
- var hex = hex1+hex2+hex3;
-
- //globalKeyManager.sig
-
-};
-
-Signature.prototype.from_ccnb =function( decoder) {
- decoder.readStartElement(this.getElementLabel());
-
- if(LOG>4)console.log('STARTED DECODING SIGNATURE ');
-
- if (decoder.peekStartElement(CCNProtocolDTags.DigestAlgorithm)) {
-
- if(LOG>4)console.log('DIGIEST ALGORITHM FOUND');
- this.digestAlgorithm = decoder.readUTF8Element(CCNProtocolDTags.DigestAlgorithm);
- }
- if (decoder.peekStartElement(CCNProtocolDTags.Witness)) {
- if(LOG>4)console.log('WITNESS FOUND FOUND');
- this.Witness = decoder.readBinaryElement(CCNProtocolDTags.Witness);
- }
-
- //FORCE TO READ A SIGNATURE
-
- //if(LOG>4)console.log('SIGNATURE FOUND ');
- this.signature = decoder.readBinaryElement(CCNProtocolDTags.SignatureBits);
- if(LOG>4)console.log('READ SIGNATURE ');
-
- decoder.readEndElement();
-
-};
-
-
-Signature.prototype.to_ccnb= function( encoder){
-
- if (!this.validate()) {
- throw new Error("Cannot encode: field values missing.");
- }
-
- encoder.writeStartElement(this.getElementLabel());
-
- if ((null != this.digestAlgorithm) && (!this.digestAlgorithm.equals(CCNDigestHelper.DEFAULT_DIGEST_ALGORITHM))) {
- encoder.writeElement(CCNProtocolDTags.DigestAlgorithm, OIDLookup.getDigestOID(this.DigestAlgorithm));
- }
-
- if (null != this.Witness) {
- // needs to handle null witness
- encoder.writeElement(CCNProtocolDTags.Witness, this.Witness);
- }
-
- encoder.writeElement(CCNProtocolDTags.SignatureBits, this.signature);
-
- encoder.writeEndElement();
-};
-
-Signature.prototype.getElementLabel = function() { return CCNProtocolDTags.Signature; };
-
-
-Signature.prototype.validate = function() {
- return null != this.signature;
-};
-
diff --git a/js/SignedInfo.js b/js/SignedInfo.js
deleted file mode 100644
index f398c4c..0000000
--- a/js/SignedInfo.js
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * @author: ucla-cs
- * This class represents SignedInfo Object
- * This keeps information about the ContentObject Signature
- */
-
-var ContentType = {DATA:0, ENCR:1, GONE:2, KEY:3, LINK:4, NACK:5};
-
-var ContentTypeValue = {0:0x0C04C0, 1:0x10D091,2:0x18E344,3:0x28463F,4:0x2C834A,5:0x34008A};
-var ContentTypeValueReverse = {0x0C04C0:0, 0x10D091:1,0x18E344:2,0x28463F:3,0x2C834A:4,0x34008A:5};
-
-
-var SignedInfo = function SignedInfo(_publisher,_timestamp,_type,_locator,_freshnessSeconds,_finalBlockID){
-
- //TODO, Check types
-
- this.publisher = _publisher; //publisherPublicKeyDigest
- this.timestamp=_timestamp; // CCN Time
- this.type=_type; // ContentType
- this.locator =_locator;//KeyLocator
- this.freshnessSeconds =_freshnessSeconds; // Integer
- this.finalBlockID=_finalBlockID; //byte array
-
-};
-
-SignedInfo.prototype.setFields = function(){
- //BASE64 -> RAW STRING
-
- //this.locator = new KeyLocator( DataUtils.toNumbersFromString(stringCertificate) ,KeyLocatorType.CERTIFICATE );
-
- var publicKeyHex = globalKeyManager.publicKey;
-
- console.log('PUBLIC KEY TO WRITE TO CONTENT OBJECT IS ');
- console.log(publicKeyHex);
-
- var publicKeyBytes = DataUtils.toNumbers(globalKeyManager.publicKey) ;
-
-
-
- //var stringCertificate = DataUtils.base64toString(globalKeyManager.certificate);
-
- //if(LOG>3)console.log('string Certificate is '+stringCertificate);
-
- //HEX -> BYTE ARRAY
- //var publisherkey = DataUtils.toNumbers(hex_sha256(stringCertificate));
-
- //if(LOG>3)console.log('publisher key is ');
- //if(LOG>3)console.log(publisherkey);
-
- var publisherKeyDigest = hex_sha256_from_bytes(publicKeyBytes);
-
- this.publisher = new PublisherPublicKeyDigest( DataUtils.toNumbers( publisherKeyDigest ) );
-
- //this.publisher = new PublisherPublicKeyDigest(publisherkey);
-
- var d = new Date();
-
- var time = d.getTime();
-
-
- this.timestamp = new CCNTime( time );
-
- if(LOG>4)console.log('TIME msec is');
-
- if(LOG>4)console.log(this.timestamp.msec);
-
- //DATA
- this.type = 0;//0x0C04C0;//ContentTypeValue[ContentType.DATA];
-
- //if(LOG>4)console.log('toNumbersFromString(stringCertificate) '+DataUtils.toNumbersFromString(stringCertificate));
-
- console.log('PUBLIC KEY TO WRITE TO CONTENT OBJECT IS ');
- console.log(publicKeyBytes);
-
- this.locator = new KeyLocator( publicKeyBytes ,KeyLocatorType.KEY );
-
- //this.locator = new KeyLocator( DataUtils.toNumbersFromString(stringCertificate) ,KeyLocatorType.CERTIFICATE );
-
-};
-
-SignedInfo.prototype.from_ccnb = function( decoder){
-
- decoder.readStartElement( this.getElementLabel() );
-
- if (decoder.peekStartElement(CCNProtocolDTags.PublisherPublicKeyDigest)) {
- if(LOG>3) console.log('DECODING PUBLISHER KEY');
- this.publisher = new PublisherPublicKeyDigest();
- this.publisher.from_ccnb(decoder);
- }
-
- if (decoder.peekStartElement(CCNProtocolDTags.Timestamp)) {
- this.timestamp = decoder.readDateTime(CCNProtocolDTags.Timestamp);
- if(LOG>4)console.log('TIMESTAMP FOUND IS '+this.timestamp);
-
- }
-
- if (decoder.peekStartElement(CCNProtocolDTags.Type)) {
- binType = decoder.readBinaryElement(CCNProtocolDTags.Type);//byte []
-
-
- //TODO Implement type of Key Reading
-
- if(LOG>4)console.log('Binary Type of of Signed Info is '+binType);
-
- this.type = binType;
-
-
- //TODO Implement type of Key Reading
-
-
- if (null == this.type) {
- throw new Error("Cannot parse signedInfo type: bytes.");
- }
-
- } else {
- this.type = ContentType.DATA; // default
- }
-
- if (decoder.peekStartElement(CCNProtocolDTags.FreshnessSeconds)) {
- this.freshnessSeconds = decoder.readIntegerElement(CCNProtocolDTags.FreshnessSeconds);
- if(LOG>4) console.log('FRESHNESS IN SECONDS IS '+ this.freshnessSeconds);
- }
-
- if (decoder.peekStartElement(CCNProtocolDTags.FinalBlockID)) {
- this.finalBlockID = decoder.readBinaryElement(CCNProtocolDTags.FinalBlockID);
- }
-
- if (decoder.peekStartElement(CCNProtocolDTags.KeyLocator)) {
- this.locator = new KeyLocator();
- this.locator.from_ccnb(decoder);
- }
-
- decoder.readEndElement();
-};
-
-SignedInfo.prototype.to_ccnb = function( encoder) {
- if (!this.validate()) {
- throw new Error("Cannot encode : field values missing.");
- }
- encoder.writeStartElement(this.getElementLabel());
-
- if (null!=this.publisher) {
- if(LOG>3) console.log('ENCODING PUBLISHER KEY' + this.publisher.publisherPublicKeyDigest);
-
- this.publisher.to_ccnb(encoder);
- }
-
- if (null!=this.timestamp) {
- encoder.writeDateTime(CCNProtocolDTags.Timestamp, this.timestamp );
- }
-
- if (null!=this.type && this.type !=0) {
-
- encoder.writeElement(CCNProtocolDTags.type, this.type);
- }
-
- if (null!=this.freshnessSeconds) {
- encoder.writeElement(CCNProtocolDTags.FreshnessSeconds, this.freshnessSeconds);
- }
-
- if (null!=this.finalBlockID) {
- encoder.writeElement(CCNProtocolDTags.FinalBlockID, this.finalBlockID);
- }
-
- if (null!=this.locator) {
- this.locator.to_ccnb(encoder);
- }
-
- encoder.writeEndElement();
-};
-
-SignedInfo.prototype.valueToType = function(){
- //for (Entry<byte [], ContentType> entry : ContentValueTypes.entrySet()) {
- //if (Arrays.equals(value, entry.getKey()))
- //return entry.getValue();
- //}
- return null;
-
-};
-
-SignedInfo.prototype.getElementLabel = function() {
- return CCNProtocolDTags.SignedInfo;
-};
-
-SignedInfo.prototype.validate = function() {
- // We don't do partial matches any more, even though encoder/decoder
- // is still pretty generous.
- if (null ==this.publisher || null==this.timestamp ||null== this.locator)
- return false;
- return true;
-};
-
diff --git a/js/testing/image-loader.html b/js/testing/image-loader.html
index a1eb6e1..f884678 100644
--- a/js/testing/image-loader.html
+++ b/js/testing/image-loader.html
@@ -17,22 +17,12 @@
<script type="text/javascript" src="../DateFormat.js"></script>
- <script type="text/javascript" src="../Exclude.js"></script>
-
- <script type="text/javascript" src="../ExcludeAny.js"></script>
-
- <script type="text/javascript" src="../ExcludeComponent.js"></script>
-
<script type="text/javascript" src="../Interest.js"></script>
<script type="text/javascript" src="../KeyLocator.js"></script>
<script type="text/javascript" src="../PublisherID.js"></script>
- <script type="text/javascript" src="../Signature.js"></script>
-
- <script type="text/javascript" src="../SignedInfo.js"></script>
-
<script type="text/javascript" src="../PublisherPublicKeyDigest.js"></script>
<script type="text/javascript" src="../FaceInstance.js"></script>
diff --git a/js/testing/image-sender.html b/js/testing/image-sender.html
index 4dca38a..6813c2e 100644
--- a/js/testing/image-sender.html
+++ b/js/testing/image-sender.html
@@ -17,22 +17,12 @@
<script type="text/javascript" src="../DateFormat.js"></script>
- <script type="text/javascript" src="../Exclude.js"></script>
-
- <script type="text/javascript" src="../ExcludeAny.js"></script>
-
- <script type="text/javascript" src="../ExcludeComponent.js"></script>
-
<script type="text/javascript" src="../Interest.js"></script>
<script type="text/javascript" src="../KeyLocator.js"></script>
<script type="text/javascript" src="../PublisherID.js"></script>
- <script type="text/javascript" src="../Signature.js"></script>
-
- <script type="text/javascript" src="../SignedInfo.js"></script>
-
<script type="text/javascript" src="../PublisherPublicKeyDigest.js"></script>
<script type="text/javascript" src="../FaceInstance.js"></script>
diff --git a/js/testing/test-connection.html b/js/testing/test-connection.html
index 2e04a64..c66ee27 100644
--- a/js/testing/test-connection.html
+++ b/js/testing/test-connection.html
@@ -17,22 +17,12 @@
<script type="text/javascript" src="../DateFormat.js"></script>
- <script type="text/javascript" src="../Exclude.js"></script>
-
- <script type="text/javascript" src="../ExcludeAny.js"></script>
-
- <script type="text/javascript" src="../ExcludeComponent.js"></script>
-
<script type="text/javascript" src="../Interest.js"></script>
<script type="text/javascript" src="../KeyLocator.js"></script>
<script type="text/javascript" src="../PublisherID.js"></script>
- <script type="text/javascript" src="../Signature.js"></script>
-
- <script type="text/javascript" src="../SignedInfo.js"></script>
-
<script type="text/javascript" src="../PublisherPublicKeyDigest.js"></script>
<script type="text/javascript" src="../FaceInstance.js"></script>
diff --git a/js/testing/test-decode-FaceInstance.html b/js/testing/test-decode-FaceInstance.html
index 999e5f2..360cd68 100644
--- a/js/testing/test-decode-FaceInstance.html
+++ b/js/testing/test-decode-FaceInstance.html
@@ -18,22 +18,12 @@
<script type="text/javascript" src="../DateFormat.js"></script>
- <script type="text/javascript" src="../Exclude.js"></script>
-
- <script type="text/javascript" src="../ExcludeAny.js"></script>
-
- <script type="text/javascript" src="../ExcludeComponent.js"></script>
-
<script type="text/javascript" src="../Interest.js"></script>
<script type="text/javascript" src="../KeyLocator.js"></script>
<script type="text/javascript" src="../PublisherID.js"></script>
- <script type="text/javascript" src="../Signature.js"></script>
-
- <script type="text/javascript" src="../SignedInfo.js"></script>
-
<script type="text/javascript" src="../PublisherPublicKeyDigest.js"></script>
<script type="text/javascript" src="../FaceInstance.js"></script>
diff --git a/js/testing/test-decode-Interest+Forwarding+Entry.html b/js/testing/test-decode-Interest+Forwarding+Entry.html
index 362b254..9607cdc 100644
--- a/js/testing/test-decode-Interest+Forwarding+Entry.html
+++ b/js/testing/test-decode-Interest+Forwarding+Entry.html
@@ -18,22 +18,12 @@
<script type="text/javascript" src="../DateFormat.js"></script>
- <script type="text/javascript" src="../Exclude.js"></script>
-
- <script type="text/javascript" src="../ExcludeAny.js"></script>
-
- <script type="text/javascript" src="../ExcludeComponent.js"></script>
-
<script type="text/javascript" src="../Interest.js"></script>
<script type="text/javascript" src="../KeyLocator.js"></script>
<script type="text/javascript" src="../PublisherID.js"></script>
- <script type="text/javascript" src="../Signature.js"></script>
-
- <script type="text/javascript" src="../SignedInfo.js"></script>
-
<script type="text/javascript" src="../PublisherPublicKeyDigest.js"></script>
<script type="text/javascript" src="../FaceInstance.js"></script>
diff --git a/js/testing/test-encode-decode-ContentObject-bis.html b/js/testing/test-encode-decode-ContentObject-bis.html
index 8ea3e93..0dcf377 100644
--- a/js/testing/test-encode-decode-ContentObject-bis.html
+++ b/js/testing/test-encode-decode-ContentObject-bis.html
@@ -18,22 +18,12 @@
<script type="text/javascript" src="../DateFormat.js"></script>
- <script type="text/javascript" src="../Exclude.js"></script>
-
- <script type="text/javascript" src="../ExcludeAny.js"></script>
-
- <script type="text/javascript" src="../ExcludeComponent.js"></script>
-
<script type="text/javascript" src="../Interest.js"></script>
<script type="text/javascript" src="../KeyLocator.js"></script>
<script type="text/javascript" src="../PublisherID.js"></script>
- <script type="text/javascript" src="../Signature.js"></script>
-
- <script type="text/javascript" src="../SignedInfo.js"></script>
-
<script type="text/javascript" src="../PublisherPublicKeyDigest.js"></script>
<script type="text/javascript" src="../FaceInstance.js"></script>
diff --git a/js/testing/test-encode-decode-ContentObject.html b/js/testing/test-encode-decode-ContentObject.html
index 08904c8..ca76d4c 100644
--- a/js/testing/test-encode-decode-ContentObject.html
+++ b/js/testing/test-encode-decode-ContentObject.html
@@ -16,22 +16,12 @@
<script type="text/javascript" src="../ContentObject.js"></script>
- <script type="text/javascript" src="../Exclude.js"></script>
-
- <script type="text/javascript" src="../ExcludeAny.js"></script>
-
- <script type="text/javascript" src="../ExcludeComponent.js"></script>
-
<script type="text/javascript" src="../Interest.js"></script>
<script type="text/javascript" src="../KeyLocator.js"></script>
<script type="text/javascript" src="../PublisherID.js"></script>
- <script type="text/javascript" src="../Signature.js"></script>
-
- <script type="text/javascript" src="../SignedInfo.js"></script>
-
<script type="text/javascript" src="../PublisherPublicKeyDigest.js"></script>
<script type="text/javascript" src="../FaceInstance.js"></script>
diff --git a/js/testing/test-encode-decode-Interest.html b/js/testing/test-encode-decode-Interest.html
index ef69d67..0fb0f4b 100644
--- a/js/testing/test-encode-decode-Interest.html
+++ b/js/testing/test-encode-decode-Interest.html
@@ -18,22 +18,12 @@
<script type="text/javascript" src="../DateFormat.js"></script>
- <script type="text/javascript" src="../Exclude.js"></script>
-
- <script type="text/javascript" src="../ExcludeAny.js"></script>
-
- <script type="text/javascript" src="../ExcludeComponent.js"></script>
-
<script type="text/javascript" src="../Interest.js"></script>
<script type="text/javascript" src="../KeyLocator.js"></script>
<script type="text/javascript" src="../PublisherID.js"></script>
- <script type="text/javascript" src="../Signature.js"></script>
-
- <script type="text/javascript" src="../SignedInfo.js"></script>
-
<script type="text/javascript" src="../PublisherPublicKeyDigest.js"></script>
<script type="text/javascript" src="../FaceInstance.js"></script>
diff --git a/js/testing/test-get.html b/js/testing/test-get.html
index c17e310..be3cbbb 100644
--- a/js/testing/test-get.html
+++ b/js/testing/test-get.html
@@ -19,22 +19,12 @@
<script type="text/javascript" src="../DateFormat.js"></script>
- <script type="text/javascript" src="../Exclude.js"></script>
-
- <script type="text/javascript" src="../ExcludeAny.js"></script>
-
- <script type="text/javascript" src="../ExcludeComponent.js"></script>
-
<script type="text/javascript" src="../Interest.js"></script>
<script type="text/javascript" src="../KeyLocator.js"></script>
<script type="text/javascript" src="../PublisherID.js"></script>
- <script type="text/javascript" src="../Signature.js"></script>
-
- <script type="text/javascript" src="../SignedInfo.js"></script>
-
<script type="text/javascript" src="../PublisherPublicKeyDigest.js"></script>
<script type="text/javascript" src="../FaceInstance.js"></script>
diff --git a/js/testing/test-interest-matches-name.html b/js/testing/test-interest-matches-name.html
index 9038369..70039fa 100644
--- a/js/testing/test-interest-matches-name.html
+++ b/js/testing/test-interest-matches-name.html
@@ -18,22 +18,12 @@
<script type="text/javascript" src="../DateFormat.js"></script>
- <script type="text/javascript" src="../Exclude.js"></script>
-
- <script type="text/javascript" src="../ExcludeAny.js"></script>
-
- <script type="text/javascript" src="../ExcludeComponent.js"></script>
-
<script type="text/javascript" src="../Interest.js"></script>
<script type="text/javascript" src="../KeyLocator.js"></script>
<script type="text/javascript" src="../PublisherID.js"></script>
- <script type="text/javascript" src="../Signature.js"></script>
-
- <script type="text/javascript" src="../SignedInfo.js"></script>
-
<script type="text/javascript" src="../PublisherPublicKeyDigest.js"></script>
<script type="text/javascript" src="../FaceInstance.js"></script>
diff --git a/js/testing/test-put.html b/js/testing/test-put.html
index 18567c1..02ec425 100644
--- a/js/testing/test-put.html
+++ b/js/testing/test-put.html
@@ -17,22 +17,12 @@
<script type="text/javascript" src="../DateFormat.js"></script>
- <script type="text/javascript" src="../Exclude.js"></script>
-
- <script type="text/javascript" src="../ExcludeAny.js"></script>
-
- <script type="text/javascript" src="../ExcludeComponent.js"></script>
-
<script type="text/javascript" src="../Interest.js"></script>
<script type="text/javascript" src="../KeyLocator.js"></script>
<script type="text/javascript" src="../PublisherID.js"></script>
- <script type="text/javascript" src="../Signature.js"></script>
-
- <script type="text/javascript" src="../SignedInfo.js"></script>
-
<script type="text/javascript" src="../PublisherPublicKeyDigest.js"></script>
<script type="text/javascript" src="../FaceInstance.js"></script>
diff --git a/js/testing/test-request-send-hex.html b/js/testing/test-request-send-hex.html
index 666d3f5..d38d706 100644
--- a/js/testing/test-request-send-hex.html
+++ b/js/testing/test-request-send-hex.html
@@ -17,22 +17,12 @@
<script type="text/javascript" src="../DateFormat.js"></script>
- <script type="text/javascript" src="../Exclude.js"></script>
-
- <script type="text/javascript" src="../ExcludeAny.js"></script>
-
- <script type="text/javascript" src="../ExcludeComponent.js"></script>
-
<script type="text/javascript" src="../Interest.js"></script>
<script type="text/javascript" src="../KeyLocator.js"></script>
<script type="text/javascript" src="../PublisherID.js"></script>
- <script type="text/javascript" src="../Signature.js"></script>
-
- <script type="text/javascript" src="../SignedInfo.js"></script>
-
<script type="text/javascript" src="../PublisherPublicKeyDigest.js"></script>
<script type="text/javascript" src="../FaceInstance.js"></script>