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