Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 1 | <?xml version = "1.0" encoding="utf-8" ?>
|
| 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
| 3 | "DTD/xhtml1-strict.dtd">
|
| 4 | <html xmlns = "http://www.w3.org/1999/xhtml">
|
| 5 |
|
| 6 | <head>
|
| 7 | <title>NDN Decode Interest + Face Instance</title>
|
| 8 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 9 | <script type="text/javascript" src="../java_socket_bridge.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 10 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 11 | <script type="text/javascript" src="../CCNProtocolDTags.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 12 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 13 | <script type="text/javascript" src="../CCNTime.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 14 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 15 | <script type="text/javascript" src="../ContentName.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 16 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 17 | <script type="text/javascript" src="../ContentObject.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 18 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 19 | <script type="text/javascript" src="../DateFormat.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 20 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 21 | <script type="text/javascript" src="../Exclude.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 22 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 23 | <script type="text/javascript" src="../ExcludeAny.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 24 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 25 | <script type="text/javascript" src="../ExcludeComponent.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 26 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 27 | <script type="text/javascript" src="../Interest.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 28 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 29 | <script type="text/javascript" src="../KeyLocator.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 30 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 31 | <script type="text/javascript" src="../KeyName.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 32 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 33 | <script type="text/javascript" src="../PublisherID.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 34 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 35 | <script type="text/javascript" src="../Signature.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 36 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 37 | <script type="text/javascript" src="../SignedInfo.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 38 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 39 | <script type="text/javascript" src="../PublisherPublicKeyDigest.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 40 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 41 | <script type="text/javascript" src="../FaceInstance.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 42 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 43 | <script type="text/javascript" src="../ForwardingEntry.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 44 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 45 | <script type="text/javascript" src="../encoding/BinaryXMLEncoder.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 46 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 47 | <script type="text/javascript" src="../encoding/BinaryXMLCodec.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 48 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 49 | <script type="text/javascript" src="../encoding/BinaryXMLDecoder.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 50 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 51 | <script type="text/javascript" src="../encoding/DataUtils.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 52 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 53 | <script type="text/javascript" src="../encoding/EncodingUtils.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 54 |
|
| 55 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 56 | <script language="JavaScript" type="text/javascript" src="../security/KeyManager.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 57 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 58 | <script language="JavaScript" type="text/javascript" src="../securityLib/jsbn.js"></script>
|
| 59 | <script language="JavaScript" type="text/javascript" src="../securityLib/jsbn2.js"></script>
|
| 60 | <script language="JavaScript" type="text/javascript" src="../securityLib/rsa.js"></script>
|
| 61 | <script language="JavaScript" type="text/javascript" src="../securityLib/rsa2.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 62 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 63 | <script language="JavaScript" type="text/javascript" src="../securityLib/sha1.js"></script>
|
| 64 | <script language="JavaScript" type="text/javascript" src="../securityLib/sha256.js"></script>
|
| 65 | <script language="JavaScript" type="text/javascript" src="../securityLib/sha512.js"></script>
|
| 66 | <script language="JavaScript" type="text/javascript" src="../securityLib/md5.js"></script>
|
| 67 | <script language="JavaScript" type="text/javascript" src="../securityLib/ripemd160.js"></script>
|
| 68 | <script language="JavaScript" type="text/javascript" src="../securityLib/base64.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 69 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 70 | <script language="JavaScript" type="text/javascript" src="../securityLib/rsapem-1.1.js"></script>
|
| 71 | <script language="JavaScript" type="text/javascript" src="../securityLib/rsasign-1.2.js"></script>
|
| 72 | <script language="JavaScript" type="text/javascript" src="../securityLib/asn1hex-1.1.js"></script>
|
| 73 | <script language="JavaScript" type="text/javascript" src="../securityLib/x509-1.1.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 74 |
|
| 75 | <script type="text/javascript">
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 | function decode(){
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 80 |
|
| 81 | var input = document.getElementById('result').innerHTML;
|
| 82 |
|
| 83 |
|
| 84 | var interest = decodeHexInterest(input);
|
| 85 |
|
| 86 | if(LOG>3)console.log('INTEREST DECODED');
|
| 87 | if(LOG>3)console.log(interest);
|
| 88 |
|
| 89 | ///////////////////////////////////////
|
| 90 |
|
| 91 | var output ="";
|
| 92 |
|
| 93 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame^] | 94 | if(interest.name!=null && interest.name.Components!=null){
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 95 | output+= "NAME: ";
|
| 96 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame^] | 97 | for(var i=0;i<interest.name.Components.length;i++){
|
| 98 | output+= "/"+ DataUtils.toString(interest.name.Components[i]);
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 99 | }
|
| 100 | output+= "<br />";
|
| 101 | output+= "<br />";
|
| 102 | }
|
| 103 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame^] | 104 | if(interest.faceInstance!=null ){
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 105 | output+= "FaceInstance: ";
|
| 106 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame^] | 107 | output+= interest.faceInstance;
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 108 |
|
| 109 | output+= "<br />";
|
| 110 | output+= "<br />";
|
| 111 | }
|
| 112 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame^] | 113 | if(interest.exclude!=null ){
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 114 | output+= "Exclude: ";
|
| 115 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame^] | 116 | output+= interest.exclude;
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 117 |
|
| 118 | output+= "<br />";
|
| 119 | output+= "<br />";
|
| 120 | }
|
| 121 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame^] | 122 | if(interest.childSelector!=null ){
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 123 | output+= "ChildSelector: ";
|
| 124 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame^] | 125 | output+= interest.childSelector;
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 126 |
|
| 127 | output+= "<br />";
|
| 128 | output+= "<br />";
|
| 129 | }
|
| 130 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame^] | 131 | if(interest.answerOriginKind!=null ){
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 132 | output+= "AnswerOriginKind: ";
|
| 133 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame^] | 134 | output+= interest.answerOriginKind;
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 135 |
|
| 136 | output+= "<br />";
|
| 137 | output+= "<br />";
|
| 138 | }
|
| 139 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame^] | 140 | if(interest.interestLifetime!=null ){
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 141 | output+= "InterestLifetime: ";
|
| 142 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame^] | 143 | output+= interest.interestLifetime;
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 144 |
|
| 145 | output+= "<br />";
|
| 146 | output+= "<br />";
|
| 147 | }
|
| 148 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame^] | 149 | if(interest.nonce!=null ){
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 150 | output+= "Nonce: ";
|
| 151 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame^] | 152 | output+= interest.nonce;
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 153 |
|
| 154 | output+= "<br />";
|
| 155 | output+= "<br />";
|
| 156 | }
|
| 157 |
|
| 158 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame^] | 159 | if(interest.scope!=null ){
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 160 | output+= "SCOPE: ";
|
| 161 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame^] | 162 | output+= interest.scope;
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 163 |
|
| 164 | output+= "<br />";
|
| 165 | output+= "<br />";
|
| 166 | }
|
| 167 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame^] | 168 | if(interest.publisherPublicKeyDigest!=null ){
|
| 169 | output+= "PUBLISHER PUBLIC KEY DIGEST: ";
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 170 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame^] | 171 | output+= interest.publisherPublicKeyDigest.PublisherPublicKeyDigest;
|
| 172 |
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 173 | output+= "<br />";
|
| 174 | output+= "<br />";
|
| 175 | }
|
| 176 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame^] | 177 | if(interest.maxSuffixComponents!=null ){
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 178 | output+= "MaxSuffixComponents : ";
|
| 179 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame^] | 180 | output+= interest.maxSuffixComponents;
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 181 |
|
| 182 | output+= "<br />";
|
| 183 | output+= "<br />";
|
| 184 | }
|
| 185 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame^] | 186 | if(interest.minSuffixComponents!=null ){
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 187 | output+= "MinSuffixComponents : ";
|
| 188 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame^] | 189 | output+= interest.minSuffixComponents;
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 190 |
|
| 191 | output+= "<br />";
|
| 192 | output+= "<br />";
|
| 193 | }
|
| 194 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame^] | 195 | if(interest.name.Components[3] !=null){
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 196 |
|
| 197 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame^] | 198 | var input = DataUtils.toHex(interest.name.Components[3]) ;
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 199 |
|
| 200 | var contentObject = decodeHexContentObject(input);
|
| 201 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame^] | 202 | if(contentObject.content!=null ){
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 203 | output+= "Content of content Object: ";
|
| 204 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame^] | 205 | output+= DataUtils.toHex(contentObject.content);
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 206 |
|
| 207 | output+= "<br />";
|
| 208 | output+= "<br />";
|
| 209 | }
|
| 210 |
|
| 211 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame^] | 212 | var content = DataUtils.toHex(contentObject.content);
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 213 |
|
| 214 | var co = contentObject;
|
| 215 |
|
| 216 |
|
| 217 | ////////////////////////////////////////
|
| 218 |
|
| 219 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame^] | 220 | if(co.name!=null && co.name.Components!=null){
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 221 | output+= "NAME: ";
|
| 222 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame^] | 223 | for(var i=0;i<co.name.Components.length;i++){
|
| 224 | output+= "/"+ DataUtils.toString(co.name.Components[i]);
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 225 | }
|
| 226 | output+= "<br />";
|
| 227 | output+= "<br />";
|
| 228 | }
|
| 229 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame^] | 230 | if(co.content !=null){
|
| 231 | output += "CONTENT(ASCII): "+ DataUtils.toString(co.content);
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 232 |
|
| 233 | output+= "<br />";
|
| 234 | output+= "<br />";
|
| 235 | }
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame^] | 236 | if(co.content !=null){
|
| 237 | output += "CONTENT(hex): "+ DataUtils.toHex(co.content);
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 238 |
|
| 239 | output+= "<br />";
|
| 240 | output+= "<br />";
|
| 241 | }
|
| 242 | if(co.Signature !=null && co.Signature.Signature!=null){
|
| 243 |
|
| 244 | output += "SIGNATURE(hex): "+ DataUtils.toHex(co.Signature.Signature);
|
| 245 |
|
| 246 | output+= "<br />";
|
| 247 | output+= "<br />";
|
| 248 | }
|
| 249 | if(co.SignedInfo !=null && co.SignedInfo.Publisher!=null && co.SignedInfo.Publisher.PublisherPublicKeyDigest!=null){
|
| 250 |
|
| 251 | output += "Publisher Public Key Digest(hex): "+ DataUtils.toHex(co.SignedInfo.Publisher.PublisherPublicKeyDigest);
|
| 252 |
|
| 253 | output+= "<br />";
|
| 254 | output+= "<br />";
|
| 255 | }
|
| 256 | if(co.SignedInfo !=null && co.SignedInfo.Timestamp!=null){
|
| 257 | var d = new Date();
|
| 258 | d.setTime( co.SignedInfo.Timestamp.msec );
|
| 259 |
|
| 260 | var bytes = [217, 185, 12, 225, 217, 185, 12, 225];
|
| 261 |
|
| 262 | output += "TimeStamp: "+d;
|
| 263 | output+= "<br />";
|
| 264 | output += "TimeStamp(number): "+ co.SignedInfo.Timestamp.msec;
|
| 265 |
|
| 266 |
|
| 267 | output+= "<br />";
|
| 268 | }
|
| 269 | if(co.SignedInfo !=null && co.SignedInfo.Type!=null){
|
| 270 |
|
| 271 | output += "Type: "+co.SignedInfo.Type;
|
| 272 | output+= "<br />";
|
| 273 | output+= "<br />";
|
| 274 | }
|
| 275 | if(co.SignedInfo !=null && co.SignedInfo.Locator!=null){
|
| 276 |
|
| 277 | output += "Locator: "+co.SignedInfo.Locator.Type;
|
| 278 | output+= "<br />";
|
| 279 | output+= "<br />";
|
| 280 | }
|
| 281 | if(co.SignedInfo !=null && co.SignedInfo.FreshnessSeconds!=null){
|
| 282 |
|
| 283 | output += "FreshnessSeconds: "+co.SignedInfo.FreshnessSeconds;
|
| 284 | output+= "<br />";
|
| 285 | output+= "<br />";
|
| 286 | }
|
| 287 | if(co.SignedInfo !=null && co.SignedInfo.FinalBlockID!=null){
|
| 288 |
|
| 289 | output += "FinalBlockID: "+co.SignedInfo.FinalBlockID;
|
| 290 | output+= "<br />";
|
| 291 | output+= "<br />";
|
| 292 | }
|
| 293 |
|
| 294 | if(co.SignedInfo!=null && co.SignedInfo.Locator!=null && co.SignedInfo.Locator.PublicKey!=null){
|
| 295 |
|
| 296 | var publickey = rstr2b64(DataUtils.toString(co.SignedInfo.Locator.PublicKey));
|
| 297 | var publickeyHex = DataUtils.toHex(co.SignedInfo.Locator.PublicKey).toLowerCase();
|
| 298 | var publickeyString = DataUtils.toString(co.SignedInfo.Locator.PublicKey);
|
| 299 |
|
| 300 | var signature = DataUtils.toHex(co.Signature.Signature).toLowerCase();
|
| 301 |
|
| 302 |
|
| 303 | var input = DataUtils.toString(co.rawSignatureData);
|
| 304 |
|
| 305 |
|
| 306 | output += "DER Certificate: "+publickey ;
|
| 307 |
|
| 308 | output+= "<br />";
|
| 309 | output+= "<br />";
|
| 310 |
|
| 311 |
|
| 312 |
|
| 313 | if(LOG>2) console.log(" ContentName + SignedInfo + Content = "+input);
|
| 314 | if(LOG>2) console.log(" PublicKey = "+publickey );
|
| 315 | if(LOG>2) console.log(" PublicKeyHex = "+publickeyHex );
|
| 316 | if(LOG>2) console.log(" PublicKeyString = "+publickeyString );
|
| 317 |
|
| 318 | if(LOG>2) console.log(" Signature "+signature );
|
| 319 |
|
| 320 | if(LOG>2) console.log(" Signature NOW IS" );
|
| 321 |
|
| 322 | if(LOG>2) console.log(co.Signature.Signature);
|
| 323 |
|
| 324 |
|
| 325 | /*var x509 = new X509();
|
| 326 |
|
| 327 | x509.readCertPEM(publickey);
|
| 328 |
|
| 329 |
|
| 330 | //x509.readCertPEMWithoutRSAInit(publickey);
|
| 331 |
|
| 332 | var result = x509.subjectPublicKeyRSA.verifyString(input, signature);*/
|
| 333 | //console.log('result is '+result);
|
| 334 |
|
| 335 |
|
| 336 | var kp = publickeyHex.slice(56,314);
|
| 337 |
|
| 338 | output += "PUBLISHER KEY(hex): "+kp ;
|
| 339 |
|
| 340 | output+= "<br />";
|
| 341 | output+= "<br />";
|
| 342 |
|
| 343 | console.log('PUBLIC KEY IN HEX is ');
|
| 344 | console.log(kp);
|
| 345 |
|
| 346 | var exp = publickeyHex.slice(318,324);
|
| 347 |
|
| 348 | console.log('kp size is '+kp.length );
|
| 349 | output += "exponent: "+exp ;
|
| 350 |
|
| 351 | output+= "<br />";
|
| 352 | output+= "<br />";
|
| 353 |
|
| 354 | console.log('EXPONENT is ');
|
| 355 | console.log(exp);
|
| 356 |
|
| 357 |
|
| 358 |
|
| 359 | /*var c1 = hex_sha256(input);
|
| 360 | var c2 = signature;
|
| 361 |
|
| 362 | if(LOG>4)console.log('input is ');
|
| 363 | if(LOG>4)console.log(input);
|
| 364 | if(LOG>4)console.log('C1 is ');
|
| 365 | if(LOG>4)console.log(c1);
|
| 366 | if(LOG>4)console.log('C2 is ');
|
| 367 | if(LOG>4)console.log(c2);
|
| 368 | var result = c1 == c2;*/
|
| 369 |
|
| 370 | var rsakey = new RSAKey();
|
| 371 |
|
| 372 | rsakey.setPublic(kp,exp);
|
| 373 |
|
| 374 | var result = rsakey.verifyString(input, signature);
|
| 375 |
|
| 376 |
|
| 377 |
|
| 378 | console.log('PUBLIC KEY n after is ');
|
| 379 | console.log(rsakey.n);
|
| 380 |
|
| 381 | console.log('EXPONENT e after is ');
|
| 382 | console.log(rsakey.e);
|
| 383 |
|
| 384 |
|
| 385 | if(result)
|
| 386 | output += 'SIGNATURE VALID';
|
| 387 | else
|
| 388 | output += 'SIGNATURE INVALID';
|
| 389 |
|
| 390 | //output += "VALID: "+ toHex(co.SignedInfo.Locator.PublicKey);
|
| 391 |
|
| 392 | output+= "<br />";
|
| 393 | output+= "<br />";
|
| 394 |
|
| 395 |
|
| 396 | //if(LOG>4) console.log('str'[1]);
|
| 397 | }
|
| 398 |
|
| 399 | ////////////////////////////////////////
|
| 400 |
|
| 401 |
|
| 402 | var forwardingEntry = decodeHexForwardingEntry(content);
|
| 403 |
|
| 404 | if(LOG>3)console.log('FORWARDING ENTRY IS PRESENT');
|
| 405 | if(LOG>3)console.log(forwardingEntry);
|
| 406 |
|
| 407 | ///////////////////////////////////////
|
| 408 |
|
| 409 | //var output ="";
|
| 410 |
|
| 411 | if(forwardingEntry.Action!=null ){
|
| 412 | output+= "Action: ";
|
| 413 |
|
| 414 | output+= DataUtils.toHex(forwardingEntry.Action);
|
| 415 |
|
| 416 | output+= "<br />";
|
| 417 | output+= "<br />";
|
| 418 | }
|
| 419 |
|
| 420 | if(forwardingEntry.PrefixName!=null){
|
| 421 | output+= "PrefixName: ";
|
| 422 |
|
| 423 | output+= forwardingEntry.PrefixName.getName();
|
| 424 | output+= "<br />";
|
| 425 | }
|
| 426 |
|
| 427 | if(forwardingEntry.CCNID!=null){
|
| 428 | output+= "CCNID: ";
|
| 429 |
|
| 430 | output+= forwardingEntry.CCNID;
|
| 431 | output+= "<br />";
|
| 432 | }
|
| 433 |
|
| 434 | if(forwardingEntry.Flags!=null){
|
| 435 | output+= "Flags: ";
|
| 436 |
|
| 437 | output+= forwardingEntry.Flags;
|
| 438 | output+= "<br />";
|
| 439 | }
|
| 440 |
|
| 441 | if(forwardingEntry.Lifetime!=null){
|
| 442 | output+= "Lifetime: ";
|
| 443 |
|
| 444 | output+= forwardingEntry.Lifetime;
|
| 445 | output+= "<br />";
|
| 446 | }
|
| 447 |
|
| 448 |
|
| 449 | }
|
| 450 |
|
| 451 |
|
| 452 |
|
| 453 | document.getElementById('result').innerHTML = output;
|
| 454 |
|
| 455 | }
|
| 456 |
|
| 457 | </script>
|
| 458 |
|
| 459 | </head>
|
| 460 | <body >
|
| 461 | <form>
|
| 462 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame^] | 463 | Please Press Decode:<br />
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 464 |
|
| 465 |
|
| 466 | </form>
|
| 467 | <button onclick="decode()">Decode</button>
|
| 468 |
|
| 469 | <!-- p id="result-old-from-ccnx">01d2f2faa563636e7800fa0285e0a01e093968f9740ce7f4361babf5bb05a4e55aaca5e58f73eddeb8e013aa8f00fabd73656c6672656700fa1bf5048202aa03b208854a18988c72aee624da28e2e1acbccb209b8e89429041985521ed68f95a1c546872fba3d854b1377dc249b6d8ec5935e5069256c97a7f6d8a62e86222ccd2cfe5097aed3fe5ede6732ce191a8680d78e39d0c5058a2b7bb0f0687994e9f045de346b66c46498547a08da1f2f0cdfafba3afdfe7107931935ede79040137ba94a90000f20001a203e202851a4860caa4991e829bcdc9429fb711d52440968d23560726606050bf147acffc0002bab504fcb3f03aa40001e201da0a9530819f300d06092a864886f70d010101050003818d00308189028181008ed27580e3d1c4c67672208665133a1ba12d8ebf5cad8e054571926b3ff0782a04c71703384021a6cefb6616b66cbd8a679b761d69d6373a851546e26f7105510b4c23be9a3c7f2e652e100ecc1471855730659f1477ce4e8504ad1fd8f44116baaeae2ff67eec33abba790157a79bf5039e5a528a471d9d67c94e70117ed7490203010001000000019a0585058a04cabe73656c6672656700f2faad726f63636f000003e20285e0a01e093968f9740ce7f4361babf5bb05a4e55aaca5e58f73eddeb8e013aa8f0004fa8e330003d2d63231343734383336343700000000000002d28e310000</p-->
|
| 470 |
|
| 471 | <p id="result">01d2f2faa563636e7800fa0285e0a01e093968f9740ce7f4361babf5bb05a4e55aaca5e58f73eddeb8e013aa8f00facd70726566697872656700fa29ad048202aa03b208854ddbf69779cdf4ef74be99474478c8bc3ca0873e0ffa1fa60120aa276db122b83404e595a8a3caeaf09630276658ba4e7beaadb4b91a8cc58e19ac4a42289507ed8d609aa9bef61a5a507f349c83d2944b8c16fecfd90d4a40ddb8687592c0a57517564235b2e359db54f51a37e1ac39e518a2196e3ffda7eb2fb301f3c404dd0000f20001a203e20285ef7c4f5d4743a8b8586ea2e741b7fc39d1dc0dbe1b1930e787cfd1d833ea7a610002bab504fce9e253d70001e2018219fd3082019b30820104020900b7d85c906bad52ee300d06092a864886f70d010105050030123110300e060355040313076178656c636476301e170d3132303432383233343433375a170d3132303532383233343433375a30123110300e060355040313076178656c63647630819f300d06092a864886f70d010101050003818d0030818902818100e17d30a7d828ab1b840b17542dcaf6207afd221e086b2a60d16cb7f54448ba9f3f08bcd099db21dd162a779e61aa89eee554d3a47de230bc7ac590d524067c3898bba6f5dc4360b845eda48cbd9cf126a723445f0e1952d7325a75faf556144f9a98af7186b0278685b8e2c08bea87171b4dee585c1828295b5395eb4a17779f0203010001300d06092a864886f70d010105050003818100cb3ab0357d7cd2ae97ed501e51a3a0e2817d418e47fb17906477af61495a7e8d8789141065b082d001f4b15193d0b43fb661cde20a6498372c6abbd3dcb9f0d12659ef07b3c6dbdf8bdf2f65477eed7adcd457d793b1c27badda7c5ade80ce95b7d8827fe78c8a35f3fb4ba648a081be2cfe84231abab3c2b531746df2e0492b000000019a02d5058a04cabe73656c6672656700f2faa56d656b69000004fa8e330003d2d63231343734383336343700000000000002d28e310000</p>
|
| 472 |
|
| 473 | </body>
|
| 474 | </html> |