diff --git a/js/SignedInfo.js b/js/SignedInfo.js
index 3d03f17..0b81201 100644
--- a/js/SignedInfo.js
+++ b/js/SignedInfo.js
@@ -13,7 +13,7 @@
 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
@@ -23,18 +23,45 @@
 
 };
 
+SignedInfo.prototype.setFields = function(){
+	//BASE64 -> RAW STRING
+	
+	var stringCertificate = DataUtils.base64toString(globalKeyManager.certificate);
+	
+	if(LOG>3)console.log('string Certificate is '+stringCertificate);
+
+	//HEX -> BYTE ARRAY
+	var publisherkey = toNumbers(hex_sha256(stringCertificate));
+	
+	if(LOG>3)console.log('publisher key is ');
+	if(LOG>3)console.log(publisherkey);
+	
+	this.Publisher = new PublisherPublicKeyDigest(publisherkey);
+
+	
+	this.Timestamp = new CCNTime('FD0499602d2000');
+	
+	this.Type = ContentType.DATA;
+	
+	console.log('toNumbersFromString(stringCertificate) '+toNumbersFromString(stringCertificate));
+	this.Locator = new KeyLocator(  toNumbersFromString(stringCertificate)  ,KeyLocatorType.KEY );
+
+};
 
 SignedInfo.prototype.decode = 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.decode(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)) {
@@ -43,22 +70,25 @@
 		
 			//TODO Implement Type of Key Reading
 			
-			//this.Type = valueToType(binType);
+			if(LOG>4)console.log('TYPE IS'+bintype);
+
+			this.Type = this.valueToType(binType);
 			
 			
 			//TODO Implement Type of Key Reading
 			
-			/*
+			
 			if (null == this.Type) {
 				throw new Exception("Cannot parse signedInfo type: bytes.");
 			}
 			
 		} else {
-			this.Type = ContentType.DATA; // default*/
+			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)) {
@@ -80,6 +110,8 @@
 		encoder.writeStartElement(this.getElementLabel());
 		
 		if (null!=this.Publisher) {
+			if(LOG>3) console.log('ENCODING PUBLISHER KEY' + this.Publisher.PublisherPublicKeyDigest);
+
 			this.Publisher.encode(encoder);
 		}
 
@@ -107,6 +139,15 @@
 		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;
 };
