blob: 67727d1c4ef8548d603f7ba1b1ff99602a4f5826 [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 Thompson7ed5ef52012-08-26 11:28:48 -070011 <script type="text/javascript" src="../CCNProtocolDTags.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070012
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070013 <script type="text/javascript" src="../CCNTime.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070014
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070015 <script type="text/javascript" src="../ContentName.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 Thompson7ed5ef52012-08-26 11:28:48 -070019 <script type="text/javascript" src="../DateFormat.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070020
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070021 <script type="text/javascript" src="../Exclude.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070022
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070023 <script type="text/javascript" src="../ExcludeAny.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070024
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070025 <script type="text/javascript" src="../ExcludeComponent.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070026
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070027 <script type="text/javascript" src="../Interest.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070028
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070029 <script type="text/javascript" src="../KeyLocator.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070030
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070031 <script type="text/javascript" src="../KeyName.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070032
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070033 <script type="text/javascript" src="../PublisherID.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070034
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070035 <script type="text/javascript" src="../Signature.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070036
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070037 <script type="text/javascript" src="../SignedInfo.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070038
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070039 <script type="text/javascript" src="../PublisherPublicKeyDigest.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070040
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070041 <script type="text/javascript" src="../FaceInstance.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070042
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070043 <script type="text/javascript" src="../ForwardingEntry.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070044
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070045 <script type="text/javascript" src="../encoding/BinaryXMLEncoder.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070046
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070047 <script type="text/javascript" src="../encoding/BinaryXMLCodec.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070048
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070049 <script type="text/javascript" src="../encoding/BinaryXMLDecoder.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070050
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070051 <script type="text/javascript" src="../encoding/DataUtils.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070052
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070053 <script type="text/javascript" src="../encoding/EncodingUtils.js"></script>
Meki Cherkaoui8f173612012-06-06 01:05:40 -070054
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070055 <script language="JavaScript" type="text/javascript" src="../security/KeyManager.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/jsbn.js"></script>
58 <script language="JavaScript" type="text/javascript" src="../securityLib/jsbn2.js"></script>
59 <script language="JavaScript" type="text/javascript" src="../securityLib/rsa.js"></script>
60 <script language="JavaScript" type="text/javascript" src="../securityLib/rsa2.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070061
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070062 <script language="JavaScript" type="text/javascript" src="../securityLib/sha1.js"></script>
63 <script language="JavaScript" type="text/javascript" src="../securityLib/sha256.js"></script>
64 <script language="JavaScript" type="text/javascript" src="../securityLib/sha512.js"></script>
65 <script language="JavaScript" type="text/javascript" src="../securityLib/md5.js"></script>
66 <script language="JavaScript" type="text/javascript" src="../securityLib/ripemd160.js"></script>
67 <script language="JavaScript" type="text/javascript" src="../securityLib/base64.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070068
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070069 <script language="JavaScript" type="text/javascript" src="../securityLib/rsapem-1.1.js"></script>
70 <script language="JavaScript" type="text/javascript" src="../securityLib/rsasign-1.2.js"></script>
71 <script language="JavaScript" type="text/javascript" src="../securityLib/asn1hex-1.1.js"></script>
72 <script language="JavaScript" type="text/javascript" src="../securityLib/x509-1.1.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070073
74 <script type="text/javascript">
75
76 function encode(){
77 var interest = new Interest( new ContentName(document.getElementById('interest').value ) );
78
Meki Cherkaoui8f173612012-06-06 01:05:40 -070079 interest.Scope = 1;
80
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070081 var output = encodeToHexInterest(interest);
82
83 document.getElementById('result').innerHTML = output;
84
85 }
86
87 function decode(){
88
89
90
91 var input = document.getElementById('result').innerHTML;
92
93
94 var interest = decodeHexInterest(input);
95
96 if(LOG>3)console.log('INTEREST DECODED');
97 if(LOG>3)console.log(interest);
98
99 ///////////////////////////////////////
100
101 var output ="";
102
103 if(interest.Name!=null && interest.Name.Components!=null){
104 output+= "NAME: ";
105
Meki Cherkaoui8f173612012-06-06 01:05:40 -0700106
107 output+= interest.Name.getName();
108
109 /*for(var i=0;i<interest.Name.Components.length;i++){
110 output+= "/"+ DataUtils.toString(interest.Name.Components[i]);
111 }*/
112
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -0700113 output+= "<br />";
114 output+= "<br />";
115 }
116
Meki Cherkaoui8f173612012-06-06 01:05:40 -0700117
118 if(interest.Scope!=null ){
119 output+= "SCOPE: ";
120
121 output+= interest.Scope;
122
123 output+= "<br />";
124 output+= "<br />";
125 }
126
127 if(interest.PublisherID!=null ){
128 output+= "PUBLISHER ID: ";
129
130 output+= interest.PublisherID.PublisherID;
131
132 output+= "PUBLISHER ID TYPE: ";
133 output+= interest.PublisherID.PublisherType;
134 output+= "<br />";
135 output+= "<br />";
136 }
137
138 if(interest.MaxSuffixComponents!=null ){
139 output+= "MaxSuffixComponents : ";
140
141 output+= interest.MaxSuffixComponents;
142
143 output+= "<br />";
144 output+= "<br />";
145 }
146
147 if(interest.MinSuffixComponents!=null ){
148 output+= "MinSuffixComponents : ";
149
150 output+= interest.MinSuffixComponents;
151
152 output+= "<br />";
153 output+= "<br />";
154 }
155
156 if(interest.MinSuffixComponents!=null ){
157 output+= "MinSuffixComponents : ";
158
159 output+= interest.MinSuffixComponents;
160
161 output+= "<br />";
162 output+= "<br />";
163 }
164
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -0700165 document.getElementById('result').innerHTML = output;
166
167 }
168
169 </script>
170
171</head>
172<body >
173 <form>
174
Jeff Thompson7ed5ef52012-08-26 11:28:48 -0700175 Please Enter an Interest:<br />
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -0700176
177 <input id="interest" type="text" name="INTERSET" value="/PARC/abc" />
178
179 </form>
180 <button onclick="encode()">Encode</button>
181 <button onclick="decode()">Decode</button>
182
Jeff Thompson7ed5ef52012-08-26 11:28:48 -0700183 <p id="result"></p>
Meki Cherkaoui8f173612012-06-06 01:05:40 -0700184
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -0700185
186
Meki Cherkaoui8f173612012-06-06 01:05:40 -0700187 <!-- p id="result">01d2f2fafdc12e4d2e532e6c6f63616c686f737400fabdc12e4d2e53525600faa563636e6400fa9d4b4559000002d28e310000</p-->
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -0700188
189</body>
190</html>