blob: 35f8538333c96fb3d06c3254530eebdcdf6b18c5 [file] [log] [blame]
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -07001<?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>
Meki Cherkaoui8f173612012-06-06 01:05:40 -07007 <title>NDN Encocde/Decode Interest</title>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -07008
Jeff Thompson7ed5ef52012-08-26 11:28:48 -07009 <script type="text/javascript" src="../java_socket_bridge.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070010
Jeff Thompsonc3164722012-09-30 18:35:02 -070011 <script type="text/javascript" src="../util/CCNProtocolDTags.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070012
Jeff Thompsonc3164722012-09-30 18:35:02 -070013 <script type="text/javascript" src="../util/CCNTime.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070014
Jeff Thompsonf3bd3592012-09-29 23:25:30 -070015 <script type="text/javascript" src="../Name.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070016
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070017 <script type="text/javascript" src="../ContentObject.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070018
Jeff Thompsonc3164722012-09-30 18:35:02 -070019 <script type="text/javascript" src="../encoding/DateFormat.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070020
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070021 <script type="text/javascript" src="../Interest.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070022
Jeff Thompsonc3164722012-09-30 18:35:02 -070023 <script type="text/javascript" src="../Key.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070024
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070025 <script type="text/javascript" src="../PublisherID.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070026
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070027 <script type="text/javascript" src="../PublisherPublicKeyDigest.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070028
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070029 <script type="text/javascript" src="../FaceInstance.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070030
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070031 <script type="text/javascript" src="../ForwardingEntry.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070032
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070033 <script type="text/javascript" src="../encoding/BinaryXMLEncoder.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070034
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070035 <script type="text/javascript" src="../encoding/BinaryXMLCodec.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070036
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070037 <script type="text/javascript" src="../encoding/BinaryXMLDecoder.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070038
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070039 <script type="text/javascript" src="../encoding/DataUtils.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070040
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070041 <script type="text/javascript" src="../encoding/EncodingUtils.js"></script>
Meki Cherkaoui8f173612012-06-06 01:05:40 -070042
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070043 <script language="JavaScript" type="text/javascript" src="../security/KeyManager.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070044
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070045 <script language="JavaScript" type="text/javascript" src="../securityLib/jsbn.js"></script>
46 <script language="JavaScript" type="text/javascript" src="../securityLib/jsbn2.js"></script>
47 <script language="JavaScript" type="text/javascript" src="../securityLib/rsa.js"></script>
48 <script language="JavaScript" type="text/javascript" src="../securityLib/rsa2.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070049
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070050 <script language="JavaScript" type="text/javascript" src="../securityLib/sha1.js"></script>
51 <script language="JavaScript" type="text/javascript" src="../securityLib/sha256.js"></script>
52 <script language="JavaScript" type="text/javascript" src="../securityLib/sha512.js"></script>
53 <script language="JavaScript" type="text/javascript" src="../securityLib/md5.js"></script>
54 <script language="JavaScript" type="text/javascript" src="../securityLib/ripemd160.js"></script>
55 <script language="JavaScript" type="text/javascript" src="../securityLib/base64.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070056
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070057 <script language="JavaScript" type="text/javascript" src="../securityLib/rsapem-1.1.js"></script>
58 <script language="JavaScript" type="text/javascript" src="../securityLib/rsasign-1.2.js"></script>
59 <script language="JavaScript" type="text/javascript" src="../securityLib/asn1hex-1.1.js"></script>
60 <script language="JavaScript" type="text/javascript" src="../securityLib/x509-1.1.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070061
62 <script type="text/javascript">
63
64 function encode(){
Jeff Thompsonf3bd3592012-09-29 23:25:30 -070065 var interest = new Interest( new Name(document.getElementById('interest').value ) );
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070066
Jeff Thompson86aea882012-09-29 17:32:48 -070067 interest.scope = 1;
Meki Cherkaoui8f173612012-06-06 01:05:40 -070068
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070069 var output = encodeToHexInterest(interest);
70
71 document.getElementById('result').innerHTML = output;
72
73 }
74
75 function decode(){
76
77
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
Jeff Thompsone85ff1d2012-09-29 21:21:57 -070091 if(interest.name!=null && interest.name.components!=null){
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070092 output+= "NAME: ";
93
Meki Cherkaoui8f173612012-06-06 01:05:40 -070094
Jeff Thompson86aea882012-09-29 17:32:48 -070095 output+= interest.name.getName();
Meki Cherkaoui8f173612012-06-06 01:05:40 -070096
Jeff Thompsone85ff1d2012-09-29 21:21:57 -070097 /*for(var i=0;i<interest.name.components.length;i++){
Jeff Thompson86aea882012-09-29 17:32:48 -070098 output+= "/"+ DataUtils.toString(interest.name.Components[i]);
Meki Cherkaoui8f173612012-06-06 01:05:40 -070099 }*/
100
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -0700101 output+= "<br />";
102 output+= "<br />";
103 }
104
Meki Cherkaoui8f173612012-06-06 01:05:40 -0700105
Jeff Thompson86aea882012-09-29 17:32:48 -0700106 if(interest.scope!=null ){
Meki Cherkaoui8f173612012-06-06 01:05:40 -0700107 output+= "SCOPE: ";
108
Jeff Thompson86aea882012-09-29 17:32:48 -0700109 output+= interest.scope;
Meki Cherkaoui8f173612012-06-06 01:05:40 -0700110
111 output+= "<br />";
112 output+= "<br />";
113 }
114
Jeff Thompson86aea882012-09-29 17:32:48 -0700115 if(interest.publisherID!=null ){
Meki Cherkaoui8f173612012-06-06 01:05:40 -0700116 output+= "PUBLISHER ID: ";
117
Jeff Thompsone85ff1d2012-09-29 21:21:57 -0700118 output+= interest.publisherID.publisherID;
Meki Cherkaoui8f173612012-06-06 01:05:40 -0700119
120 output+= "PUBLISHER ID TYPE: ";
Jeff Thompsone85ff1d2012-09-29 21:21:57 -0700121 output+= interest.publisherID.publisherType;
Meki Cherkaoui8f173612012-06-06 01:05:40 -0700122 output+= "<br />";
123 output+= "<br />";
124 }
125
Jeff Thompson86aea882012-09-29 17:32:48 -0700126 if(interest.maxSuffixComponents!=null ){
Meki Cherkaoui8f173612012-06-06 01:05:40 -0700127 output+= "MaxSuffixComponents : ";
128
Jeff Thompson86aea882012-09-29 17:32:48 -0700129 output+= interest.maxSuffixComponents;
Meki Cherkaoui8f173612012-06-06 01:05:40 -0700130
131 output+= "<br />";
132 output+= "<br />";
133 }
134
Jeff Thompson86aea882012-09-29 17:32:48 -0700135 if(interest.minSuffixComponents!=null ){
Meki Cherkaoui8f173612012-06-06 01:05:40 -0700136 output+= "MinSuffixComponents : ";
137
Jeff Thompson86aea882012-09-29 17:32:48 -0700138 output+= interest.minSuffixComponents;
Meki Cherkaoui8f173612012-06-06 01:05:40 -0700139
140 output+= "<br />";
141 output+= "<br />";
142 }
143
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -0700144 document.getElementById('result').innerHTML = output;
145
146 }
147
148 </script>
149
150</head>
151<body >
152 <form>
153
Jeff Thompson7ed5ef52012-08-26 11:28:48 -0700154 Please Enter an Interest:<br />
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -0700155
jeff9797d3d2012-09-03 15:07:13 -0700156 <input id="interest" type="text" name="INTEREST" value="/PARC/abc" />
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -0700157
158 </form>
159 <button onclick="encode()">Encode</button>
160 <button onclick="decode()">Decode</button>
161
Jeff Thompson7ed5ef52012-08-26 11:28:48 -0700162 <p id="result"></p>
Meki Cherkaoui8f173612012-06-06 01:05:40 -0700163
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -0700164
165
Meki Cherkaoui8f173612012-06-06 01:05:40 -0700166 <!-- p id="result">01d2f2fafdc12e4d2e532e6c6f63616c686f737400fabdc12e4d2e53525600faa563636e6400fa9d4b4559000002d28e310000</p-->
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -0700167
168</body>
jeff9797d3d2012-09-03 15:07:13 -0700169</html>