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">
|
Jeff Burke | 92dd8e4 | 2012-12-08 11:40:31 -0800 | [diff] [blame] | 4 | <!--
|
| 5 | See COPYING for copyright and distribution information.
|
| 6 | -->
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 7 | <html xmlns = "http://www.w3.org/1999/xhtml">
|
| 8 |
|
| 9 | <head>
|
| 10 | <title>NDN Decode Interest + Face Instance</title>
|
| 11 |
|
Alexander Afanasyev | 2a2c9d2 | 2013-03-13 16:21:32 -0700 | [diff] [blame] | 12 | <script type="text/javascript" src="../build/ndn-js.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 13 |
|
| 14 | <script type="text/javascript">
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 | function decode(){
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 19 |
|
| 20 | var input = document.getElementById('result').innerHTML;
|
| 21 |
|
| 22 |
|
| 23 | var interest = decodeHexInterest(input);
|
| 24 |
|
| 25 | if(LOG>3)console.log('INTEREST DECODED');
|
| 26 | if(LOG>3)console.log(interest);
|
| 27 |
|
| 28 | ///////////////////////////////////////
|
| 29 |
|
| 30 | var output ="";
|
| 31 |
|
| 32 |
|
Jeff Thompson | e85ff1d | 2012-09-29 21:21:57 -0700 | [diff] [blame] | 33 | if(interest.name!=null && interest.name.components!=null){
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 34 | output+= "NAME: ";
|
| 35 |
|
Jeff Thompson | e85ff1d | 2012-09-29 21:21:57 -0700 | [diff] [blame] | 36 | for(var i=0;i<interest.name.components.length;i++){
|
| 37 | output+= "/"+ DataUtils.toString(interest.name.components[i]);
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 38 | }
|
| 39 | output+= "<br />";
|
| 40 | output+= "<br />";
|
| 41 | }
|
| 42 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame] | 43 | if(interest.faceInstance!=null ){
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 44 | output+= "FaceInstance: ";
|
| 45 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame] | 46 | output+= interest.faceInstance;
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 47 |
|
| 48 | output+= "<br />";
|
| 49 | output+= "<br />";
|
| 50 | }
|
| 51 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame] | 52 | if(interest.exclude!=null ){
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 53 | output+= "Exclude: ";
|
| 54 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame] | 55 | output+= interest.exclude;
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 56 |
|
| 57 | output+= "<br />";
|
| 58 | output+= "<br />";
|
| 59 | }
|
| 60 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame] | 61 | if(interest.childSelector!=null ){
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 62 | output+= "ChildSelector: ";
|
| 63 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame] | 64 | output+= interest.childSelector;
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 65 |
|
| 66 | output+= "<br />";
|
| 67 | output+= "<br />";
|
| 68 | }
|
| 69 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame] | 70 | if(interest.answerOriginKind!=null ){
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 71 | output+= "AnswerOriginKind: ";
|
| 72 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame] | 73 | output+= interest.answerOriginKind;
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 74 |
|
| 75 | output+= "<br />";
|
| 76 | output+= "<br />";
|
| 77 | }
|
| 78 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame] | 79 | if(interest.interestLifetime!=null ){
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 80 | output+= "InterestLifetime: ";
|
| 81 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame] | 82 | output+= interest.interestLifetime;
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 83 |
|
| 84 | output+= "<br />";
|
| 85 | output+= "<br />";
|
| 86 | }
|
| 87 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame] | 88 | if(interest.nonce!=null ){
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 89 | output+= "Nonce: ";
|
| 90 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame] | 91 | output+= interest.nonce;
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 92 |
|
| 93 | output+= "<br />";
|
| 94 | output+= "<br />";
|
| 95 | }
|
| 96 |
|
| 97 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame] | 98 | if(interest.scope!=null ){
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 99 | output+= "SCOPE: ";
|
| 100 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame] | 101 | output+= interest.scope;
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 102 |
|
| 103 | output+= "<br />";
|
| 104 | output+= "<br />";
|
| 105 | }
|
| 106 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame] | 107 | if(interest.publisherPublicKeyDigest!=null ){
|
| 108 | output+= "PUBLISHER PUBLIC KEY DIGEST: ";
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 109 |
|
Jeff Thompson | e85ff1d | 2012-09-29 21:21:57 -0700 | [diff] [blame] | 110 | output+= interest.publisherPublicKeyDigest.publisherPublicKeyDigest;
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame] | 111 |
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 112 | output+= "<br />";
|
| 113 | output+= "<br />";
|
| 114 | }
|
| 115 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame] | 116 | if(interest.maxSuffixComponents!=null ){
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 117 | output+= "MaxSuffixComponents : ";
|
| 118 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame] | 119 | output+= interest.maxSuffixComponents;
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 120 |
|
| 121 | output+= "<br />";
|
| 122 | output+= "<br />";
|
| 123 | }
|
| 124 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame] | 125 | if(interest.minSuffixComponents!=null ){
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 126 | output+= "MinSuffixComponents : ";
|
| 127 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame] | 128 | output+= interest.minSuffixComponents;
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 129 |
|
| 130 | output+= "<br />";
|
| 131 | output+= "<br />";
|
| 132 | }
|
| 133 |
|
Jeff Thompson | e85ff1d | 2012-09-29 21:21:57 -0700 | [diff] [blame] | 134 | if(interest.name.components[3] !=null){
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 135 |
|
| 136 |
|
Jeff Thompson | e85ff1d | 2012-09-29 21:21:57 -0700 | [diff] [blame] | 137 | var input = DataUtils.toHex(interest.name.components[3]) ;
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 138 |
|
| 139 | var contentObject = decodeHexContentObject(input);
|
| 140 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame] | 141 | if(contentObject.content!=null ){
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 142 | output+= "Content of content Object: ";
|
| 143 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame] | 144 | output+= DataUtils.toHex(contentObject.content);
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 145 |
|
| 146 | output+= "<br />";
|
| 147 | output+= "<br />";
|
| 148 | }
|
| 149 |
|
| 150 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame] | 151 | var content = DataUtils.toHex(contentObject.content);
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 152 |
|
| 153 | var co = contentObject;
|
| 154 |
|
| 155 |
|
| 156 | ////////////////////////////////////////
|
| 157 |
|
| 158 |
|
Jeff Thompson | e85ff1d | 2012-09-29 21:21:57 -0700 | [diff] [blame] | 159 | if(co.name!=null && co.name.components!=null){
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 160 | output+= "NAME: ";
|
| 161 |
|
Jeff Thompson | e85ff1d | 2012-09-29 21:21:57 -0700 | [diff] [blame] | 162 | for(var i=0;i<co.name.components.length;i++){
|
| 163 | output+= "/"+ DataUtils.toString(co.name.components[i]);
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 164 | }
|
| 165 | output+= "<br />";
|
| 166 | output+= "<br />";
|
| 167 | }
|
| 168 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame] | 169 | if(co.content !=null){
|
| 170 | output += "CONTENT(ASCII): "+ DataUtils.toString(co.content);
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 171 |
|
| 172 | output+= "<br />";
|
| 173 | output+= "<br />";
|
| 174 | }
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame] | 175 | if(co.content !=null){
|
| 176 | output += "CONTENT(hex): "+ DataUtils.toHex(co.content);
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 177 |
|
| 178 | output+= "<br />";
|
| 179 | output+= "<br />";
|
| 180 | }
|
Jeff Thompson | e85ff1d | 2012-09-29 21:21:57 -0700 | [diff] [blame] | 181 | if(co.signature !=null && co.signature.signature!=null){
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 182 |
|
Jeff Thompson | e85ff1d | 2012-09-29 21:21:57 -0700 | [diff] [blame] | 183 | output += "SIGNATURE(hex): "+ DataUtils.toHex(co.signature.signature);
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 184 |
|
| 185 | output+= "<br />";
|
| 186 | output+= "<br />";
|
| 187 | }
|
Jeff Thompson | e85ff1d | 2012-09-29 21:21:57 -0700 | [diff] [blame] | 188 | if(co.signedInfo !=null && co.signedInfo.publisher!=null && co.signedInfo.publisher.publisherPublicKeyDigest!=null){
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 189 |
|
Jeff Thompson | e85ff1d | 2012-09-29 21:21:57 -0700 | [diff] [blame] | 190 | output += "Publisher Public Key Digest(hex): "+ DataUtils.toHex(co.signedInfo.publisher.publisherPublicKeyDigest);
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 191 |
|
| 192 | output+= "<br />";
|
| 193 | output+= "<br />";
|
| 194 | }
|
Jeff Thompson | e85ff1d | 2012-09-29 21:21:57 -0700 | [diff] [blame] | 195 | if(co.signedInfo !=null && co.signedInfo.timestamp!=null){
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 196 | var d = new Date();
|
Jeff Thompson | e85ff1d | 2012-09-29 21:21:57 -0700 | [diff] [blame] | 197 | d.setTime( co.signedInfo.timestamp.msec );
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 198 |
|
| 199 | var bytes = [217, 185, 12, 225, 217, 185, 12, 225];
|
| 200 |
|
| 201 | output += "TimeStamp: "+d;
|
| 202 | output+= "<br />";
|
Jeff Thompson | e85ff1d | 2012-09-29 21:21:57 -0700 | [diff] [blame] | 203 | output += "TimeStamp(number): "+ co.signedInfo.timestamp.msec;
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 204 |
|
| 205 |
|
| 206 | output+= "<br />";
|
| 207 | }
|
Jeff Thompson | e85ff1d | 2012-09-29 21:21:57 -0700 | [diff] [blame] | 208 | if(co.signedInfo !=null && co.signedInfo.type!=null){
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 209 |
|
Jeff Thompson | e85ff1d | 2012-09-29 21:21:57 -0700 | [diff] [blame] | 210 | output += "Type: "+co.signedInfo.type;
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 211 | output+= "<br />";
|
| 212 | output+= "<br />";
|
| 213 | }
|
Jeff Thompson | e85ff1d | 2012-09-29 21:21:57 -0700 | [diff] [blame] | 214 | if(co.signedInfo !=null && co.signedInfo.locator!=null){
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 215 |
|
Jeff Thompson | e85ff1d | 2012-09-29 21:21:57 -0700 | [diff] [blame] | 216 | output += "Locator: "+co.signedInfo.locator.type;
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 217 | output+= "<br />";
|
| 218 | output+= "<br />";
|
| 219 | }
|
Jeff Thompson | e85ff1d | 2012-09-29 21:21:57 -0700 | [diff] [blame] | 220 | if(co.signedInfo !=null && co.signedInfo.freshnessSeconds!=null){
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 221 |
|
Jeff Thompson | e85ff1d | 2012-09-29 21:21:57 -0700 | [diff] [blame] | 222 | output += "FreshnessSeconds: "+co.signedInfo.freshnessSeconds;
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 223 | output+= "<br />";
|
| 224 | output+= "<br />";
|
| 225 | }
|
Jeff Thompson | e85ff1d | 2012-09-29 21:21:57 -0700 | [diff] [blame] | 226 | if(co.signedInfo !=null && co.signedInfo.finalBlockID!=null){
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 227 |
|
Jeff Thompson | e85ff1d | 2012-09-29 21:21:57 -0700 | [diff] [blame] | 228 | output += "FinalBlockID: "+co.signedInfo.finalBlockID;
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 229 | output+= "<br />";
|
| 230 | output+= "<br />";
|
| 231 | }
|
| 232 |
|
Jeff Thompson | e85ff1d | 2012-09-29 21:21:57 -0700 | [diff] [blame] | 233 | if(co.signedInfo!=null && co.signedInfo.locator!=null && co.signedInfo.locator.publicKey!=null){
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 234 |
|
Jeff Thompson | e85ff1d | 2012-09-29 21:21:57 -0700 | [diff] [blame] | 235 | var publickey = rstr2b64(DataUtils.toString(co.signedInfo.locator.publicKey));
|
| 236 | var publickeyHex = DataUtils.toHex(co.signedInfo.locator.publicKey).toLowerCase();
|
| 237 | var publickeyString = DataUtils.toString(co.signedInfo.locator.publicKey);
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 238 |
|
Jeff Thompson | e85ff1d | 2012-09-29 21:21:57 -0700 | [diff] [blame] | 239 | var signature = DataUtils.toHex(co.signature.signature).toLowerCase();
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 240 |
|
| 241 |
|
| 242 | var input = DataUtils.toString(co.rawSignatureData);
|
| 243 |
|
| 244 |
|
| 245 | output += "DER Certificate: "+publickey ;
|
| 246 |
|
| 247 | output+= "<br />";
|
| 248 | output+= "<br />";
|
| 249 |
|
| 250 |
|
| 251 |
|
| 252 | if(LOG>2) console.log(" ContentName + SignedInfo + Content = "+input);
|
| 253 | if(LOG>2) console.log(" PublicKey = "+publickey );
|
| 254 | if(LOG>2) console.log(" PublicKeyHex = "+publickeyHex );
|
| 255 | if(LOG>2) console.log(" PublicKeyString = "+publickeyString );
|
| 256 |
|
| 257 | if(LOG>2) console.log(" Signature "+signature );
|
| 258 |
|
| 259 | if(LOG>2) console.log(" Signature NOW IS" );
|
| 260 |
|
Jeff Thompson | e85ff1d | 2012-09-29 21:21:57 -0700 | [diff] [blame] | 261 | if(LOG>2) console.log(co.signature.signature);
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 262 |
|
| 263 |
|
| 264 | /*var x509 = new X509();
|
| 265 |
|
| 266 | x509.readCertPEM(publickey);
|
| 267 |
|
| 268 |
|
| 269 | //x509.readCertPEMWithoutRSAInit(publickey);
|
| 270 |
|
| 271 | var result = x509.subjectPublicKeyRSA.verifyString(input, signature);*/
|
| 272 | //console.log('result is '+result);
|
| 273 |
|
| 274 |
|
| 275 | var kp = publickeyHex.slice(56,314);
|
| 276 |
|
| 277 | output += "PUBLISHER KEY(hex): "+kp ;
|
| 278 |
|
| 279 | output+= "<br />";
|
| 280 | output+= "<br />";
|
| 281 |
|
| 282 | console.log('PUBLIC KEY IN HEX is ');
|
| 283 | console.log(kp);
|
| 284 |
|
| 285 | var exp = publickeyHex.slice(318,324);
|
| 286 |
|
| 287 | console.log('kp size is '+kp.length );
|
| 288 | output += "exponent: "+exp ;
|
| 289 |
|
| 290 | output+= "<br />";
|
| 291 | output+= "<br />";
|
| 292 |
|
| 293 | console.log('EXPONENT is ');
|
| 294 | console.log(exp);
|
| 295 |
|
| 296 |
|
| 297 |
|
| 298 | /*var c1 = hex_sha256(input);
|
| 299 | var c2 = signature;
|
| 300 |
|
| 301 | if(LOG>4)console.log('input is ');
|
| 302 | if(LOG>4)console.log(input);
|
| 303 | if(LOG>4)console.log('C1 is ');
|
| 304 | if(LOG>4)console.log(c1);
|
| 305 | if(LOG>4)console.log('C2 is ');
|
| 306 | if(LOG>4)console.log(c2);
|
| 307 | var result = c1 == c2;*/
|
| 308 |
|
| 309 | var rsakey = new RSAKey();
|
| 310 |
|
| 311 | rsakey.setPublic(kp,exp);
|
| 312 |
|
| 313 | var result = rsakey.verifyString(input, signature);
|
| 314 |
|
| 315 |
|
| 316 |
|
| 317 | console.log('PUBLIC KEY n after is ');
|
| 318 | console.log(rsakey.n);
|
| 319 |
|
| 320 | console.log('EXPONENT e after is ');
|
| 321 | console.log(rsakey.e);
|
| 322 |
|
| 323 |
|
| 324 | if(result)
|
| 325 | output += 'SIGNATURE VALID';
|
| 326 | else
|
| 327 | output += 'SIGNATURE INVALID';
|
| 328 |
|
Jeff Thompson | e85ff1d | 2012-09-29 21:21:57 -0700 | [diff] [blame] | 329 | //output += "VALID: "+ toHex(co.signedInfo.locator.publicKey);
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 330 |
|
| 331 | output+= "<br />";
|
| 332 | output+= "<br />";
|
| 333 |
|
| 334 |
|
| 335 | //if(LOG>4) console.log('str'[1]);
|
| 336 | }
|
| 337 |
|
| 338 | ////////////////////////////////////////
|
| 339 |
|
| 340 |
|
| 341 | var forwardingEntry = decodeHexForwardingEntry(content);
|
| 342 |
|
| 343 | if(LOG>3)console.log('FORWARDING ENTRY IS PRESENT');
|
| 344 | if(LOG>3)console.log(forwardingEntry);
|
| 345 |
|
| 346 | ///////////////////////////////////////
|
| 347 |
|
| 348 | //var output ="";
|
| 349 |
|
Jeff Thompson | e85ff1d | 2012-09-29 21:21:57 -0700 | [diff] [blame] | 350 | if(forwardingEntry.action!=null ){
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 351 | output+= "Action: ";
|
| 352 |
|
Jeff Thompson | e85ff1d | 2012-09-29 21:21:57 -0700 | [diff] [blame] | 353 | output+= DataUtils.toHex(forwardingEntry.action);
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 354 |
|
| 355 | output+= "<br />";
|
| 356 | output+= "<br />";
|
| 357 | }
|
| 358 |
|
Jeff Thompson | e85ff1d | 2012-09-29 21:21:57 -0700 | [diff] [blame] | 359 | if(forwardingEntry.prefixName!=null){
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 360 | output+= "PrefixName: ";
|
| 361 |
|
Jeff Thompson | e85ff1d | 2012-09-29 21:21:57 -0700 | [diff] [blame] | 362 | output+= forwardingEntry.prefixName.getName();
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 363 | output+= "<br />";
|
| 364 | }
|
| 365 |
|
Jeff Thompson | e85ff1d | 2012-09-29 21:21:57 -0700 | [diff] [blame] | 366 | if(forwardingEntry.ccndID!=null){
|
| 367 | output+= "ccndID: ";
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 368 |
|
Jeff Thompson | e85ff1d | 2012-09-29 21:21:57 -0700 | [diff] [blame] | 369 | output+= forwardingEntry.ccndID;
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 370 | output+= "<br />";
|
| 371 | }
|
| 372 |
|
Jeff Thompson | e85ff1d | 2012-09-29 21:21:57 -0700 | [diff] [blame] | 373 | if(forwardingEntry.flags!=null){
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 374 | output+= "Flags: ";
|
| 375 |
|
Jeff Thompson | e85ff1d | 2012-09-29 21:21:57 -0700 | [diff] [blame] | 376 | output+= forwardingEntry.flags;
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 377 | output+= "<br />";
|
| 378 | }
|
| 379 |
|
Jeff Thompson | e85ff1d | 2012-09-29 21:21:57 -0700 | [diff] [blame] | 380 | if(forwardingEntry.lifetime!=null){
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 381 | output+= "Lifetime: ";
|
| 382 |
|
Jeff Thompson | e85ff1d | 2012-09-29 21:21:57 -0700 | [diff] [blame] | 383 | output+= forwardingEntry.lifetime;
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 384 | output+= "<br />";
|
| 385 | }
|
| 386 |
|
| 387 |
|
| 388 | }
|
| 389 |
|
| 390 |
|
| 391 |
|
| 392 | document.getElementById('result').innerHTML = output;
|
| 393 |
|
| 394 | }
|
| 395 |
|
| 396 | </script>
|
| 397 |
|
| 398 | </head>
|
| 399 | <body >
|
| 400 | <form>
|
| 401 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame] | 402 | Please Press Decode:<br />
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 403 |
|
| 404 |
|
| 405 | </form>
|
| 406 | <button onclick="decode()">Decode</button>
|
| 407 |
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 408 | <p id="result">01d2f2faa563636e7800fa0285e0a01e093968f9740ce7f4361babf5bb05a4e55aaca5e58f73eddeb8e013aa8f00facd70726566697872656700fa29ad048202aa03b208854ddbf69779cdf4ef74be99474478c8bc3ca0873e0ffa1fa60120aa276db122b83404e595a8a3caeaf09630276658ba4e7beaadb4b91a8cc58e19ac4a42289507ed8d609aa9bef61a5a507f349c83d2944b8c16fecfd90d4a40ddb8687592c0a57517564235b2e359db54f51a37e1ac39e518a2196e3ffda7eb2fb301f3c404dd0000f20001a203e20285ef7c4f5d4743a8b8586ea2e741b7fc39d1dc0dbe1b1930e787cfd1d833ea7a610002bab504fce9e253d70001e2018219fd3082019b30820104020900b7d85c906bad52ee300d06092a864886f70d010105050030123110300e060355040313076178656c636476301e170d3132303432383233343433375a170d3132303532383233343433375a30123110300e060355040313076178656c63647630819f300d06092a864886f70d010101050003818d0030818902818100e17d30a7d828ab1b840b17542dcaf6207afd221e086b2a60d16cb7f54448ba9f3f08bcd099db21dd162a779e61aa89eee554d3a47de230bc7ac590d524067c3898bba6f5dc4360b845eda48cbd9cf126a723445f0e1952d7325a75faf556144f9a98af7186b0278685b8e2c08bea87171b4dee585c1828295b5395eb4a17779f0203010001300d06092a864886f70d010105050003818100cb3ab0357d7cd2ae97ed501e51a3a0e2817d418e47fb17906477af61495a7e8d8789141065b082d001f4b15193d0b43fb661cde20a6498372c6abbd3dcb9f0d12659ef07b3c6dbdf8bdf2f65477eed7adcd457d793b1c27badda7c5ade80ce95b7d8827fe78c8a35f3fb4ba648a081be2cfe84231abab3c2b531746df2e0492b000000019a02d5058a04cabe73656c6672656700f2faa56d656b69000004fa8e330003d2d63231343734383336343700000000000002d28e310000</p>
|
| 409 |
|
| 410 | </body>
|
| 411 | </html> |