blob: 6818a8649cf324eade9f0324a2af2e89c3e056fe [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 Encode/Decode Content Object</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 Cherkaoui8f173612012-06-06 01:05:40 -070018
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070019 <script type="text/javascript" src="../Exclude.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070020
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070021 <script type="text/javascript" src="../ExcludeAny.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070022
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070023 <script type="text/javascript" src="../ExcludeComponent.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070024
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070025 <script type="text/javascript" src="../Interest.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070026
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070027 <script type="text/javascript" src="../KeyLocator.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070028
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070029 <script type="text/javascript" src="../KeyName.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070030
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070031 <script type="text/javascript" src="../PublisherID.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070032
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070033 <script type="text/javascript" src="../Signature.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070034
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070035 <script type="text/javascript" src="../SignedInfo.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070036
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070037 <script type="text/javascript" src="../PublisherPublicKeyDigest.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070038
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070039 <script type="text/javascript" src="../FaceInstance.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070040
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070041 <script type="text/javascript" src="../ForwardingEntry.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070042
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070043 <script type="text/javascript" src="../encoding/BinaryXMLEncoder.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070044
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070045 <script type="text/javascript" src="../encoding/BinaryXMLCodec.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070046
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070047 <script type="text/javascript" src="../encoding/BinaryXMLDecoder.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070048
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070049 <script type="text/javascript" src="../encoding/DataUtils.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070050
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070051 <script type="text/javascript" src="../encoding/EncodingUtils.js"></script>
Meki Cherkaoui8f173612012-06-06 01:05:40 -070052
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070053 <script language="JavaScript" type="text/javascript" src="../security/KeyManager.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070054
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070055 <script language="JavaScript" type="text/javascript" src="../securityLib/jsbn.js"></script>
56 <script language="JavaScript" type="text/javascript" src="../securityLib/jsbn2.js"></script>
57 <script language="JavaScript" type="text/javascript" src="../securityLib/rsa.js"></script>
58 <script language="JavaScript" type="text/javascript" src="../securityLib/rsa2.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070059
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070060 <script language="JavaScript" type="text/javascript" src="../securityLib/sha1.js"></script>
61 <script language="JavaScript" type="text/javascript" src="../securityLib/sha256.js"></script>
62 <script language="JavaScript" type="text/javascript" src="../securityLib/sha512.js"></script>
63 <script language="JavaScript" type="text/javascript" src="../securityLib/md5.js"></script>
64 <script language="JavaScript" type="text/javascript" src="../securityLib/ripemd160.js"></script>
65 <script language="JavaScript" type="text/javascript" src="../securityLib/base64.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070066
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070067 <script language="JavaScript" type="text/javascript" src="../securityLib/rsapem-1.1.js"></script>
68 <script language="JavaScript" type="text/javascript" src="../securityLib/rsasign-1.2.js"></script>
69 <script language="JavaScript" type="text/javascript" src="../securityLib/asn1hex-1.1.js"></script>
70 <script language="JavaScript" type="text/javascript" src="../securityLib/x509-1.1.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070071
72 <script type="text/javascript">
73
74 function encode(){
Meki Cherkaoui8f173612012-06-06 01:05:40 -070075 var contentname = new ContentName( document.getElementById('contentname').value );
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070076
77 var content = document.getElementById('content').value;
78
79 var signedInfo = new SignedInfo();
Meki Cherkaoui8f173612012-06-06 01:05:40 -070080
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070081 signedInfo.setFields();
82 //var signatureBits = generateSignatureBits(contentname,content,signedInfo);
83
84 //witness is null
85 var signature = new Signature();
86
87
88 var co = new ContentObject(contentname,signedInfo,content,signature);
89
90 co.sign();
91
92
93 var output = encodeToHexContentObject(co);
94
95 document.getElementById('result').innerHTML = output;
96
97 }
98
99 function decode(){
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -0700100 var input = document.getElementById('result').innerHTML;
101
Meki Cherkaoui8f173612012-06-06 01:05:40 -0700102 input = input.toUpperCase();
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -0700103
104 var co = decodeHexContentObject(input);
105
106 if(LOG>3)console.log('CONTENT OBJECT DECODED');
107 if(LOG>3)console.log(co);
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -0700108
jeffcc8b3a92012-09-03 15:13:27 -0700109 document.getElementById('result').innerHTML = contentObjectToHtml(co);
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -0700110 }
111
112 </script>
113
114</head>
115<body >
116 <form>
117
118 Please Enter a Content Name:<br />
119
120 <input id="contentname" type="text" name="CONTENTNAME" value="/PARC/abc" />
121
Jeff Thompson12b029d2012-08-26 11:51:27 -0700122 <br />Please Enter the Content:<br />
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -0700123
124 <textarea id="content" cols="40" rows="5" name="CONTENT" value="SUCCESS" >SUCCESS!</textarea>
125
126 </form>
127 <button onclick="encode()">Encode</button>
128 <button onclick="decode()">Decode</button>
129
130
Jeff Thompson12b029d2012-08-26 11:51:27 -0700131 <p id="result"></p>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -0700132
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -0700133
134</body>
jeffcc8b3a92012-09-03 15:13:27 -0700135</html>