blob: 55d80ed1097ba2932ca3f9915cd3db02c2748a6b [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 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 Cherkaoui8f173612012-06-06 01:05:40 -070018
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070019 <script type="text/javascript" src="../Interest.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070020
Jeff Thompsonc3164722012-09-30 18:35:02 -070021 <script type="text/javascript" src="../Key.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070022
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070023 <script type="text/javascript" src="../PublisherID.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070024
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070025 <script type="text/javascript" src="../PublisherPublicKeyDigest.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070026
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070027 <script type="text/javascript" src="../FaceInstance.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070028
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070029 <script type="text/javascript" src="../ForwardingEntry.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070030
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070031 <script type="text/javascript" src="../encoding/BinaryXMLEncoder.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070032
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070033 <script type="text/javascript" src="../encoding/BinaryXMLCodec.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070034
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070035 <script type="text/javascript" src="../encoding/BinaryXMLDecoder.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070036
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070037 <script type="text/javascript" src="../encoding/DataUtils.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070038
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070039 <script type="text/javascript" src="../encoding/EncodingUtils.js"></script>
Meki Cherkaoui8f173612012-06-06 01:05:40 -070040
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070041 <script language="JavaScript" type="text/javascript" src="../security/KeyManager.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070042
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070043 <script language="JavaScript" type="text/javascript" src="../securityLib/jsbn.js"></script>
44 <script language="JavaScript" type="text/javascript" src="../securityLib/jsbn2.js"></script>
45 <script language="JavaScript" type="text/javascript" src="../securityLib/rsa.js"></script>
46 <script language="JavaScript" type="text/javascript" src="../securityLib/rsa2.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070047
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070048 <script language="JavaScript" type="text/javascript" src="../securityLib/sha1.js"></script>
49 <script language="JavaScript" type="text/javascript" src="../securityLib/sha256.js"></script>
50 <script language="JavaScript" type="text/javascript" src="../securityLib/sha512.js"></script>
51 <script language="JavaScript" type="text/javascript" src="../securityLib/md5.js"></script>
52 <script language="JavaScript" type="text/javascript" src="../securityLib/ripemd160.js"></script>
53 <script language="JavaScript" type="text/javascript" src="../securityLib/base64.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/rsapem-1.1.js"></script>
56 <script language="JavaScript" type="text/javascript" src="../securityLib/rsasign-1.2.js"></script>
57 <script language="JavaScript" type="text/javascript" src="../securityLib/asn1hex-1.1.js"></script>
58 <script language="JavaScript" type="text/javascript" src="../securityLib/x509-1.1.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070059
60 <script type="text/javascript">
61
62 function encode(){
Jeff Thompsonf3bd3592012-09-29 23:25:30 -070063 var contentname = new Name( document.getElementById('contentname').value );
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070064
65 var content = document.getElementById('content').value;
66
67 var signedInfo = new SignedInfo();
Meki Cherkaoui8f173612012-06-06 01:05:40 -070068
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070069 signedInfo.setFields();
70 //var signatureBits = generateSignatureBits(contentname,content,signedInfo);
71
72 //witness is null
73 var signature = new Signature();
74
75
76 var co = new ContentObject(contentname,signedInfo,content,signature);
77
78 co.sign();
79
80
81 var output = encodeToHexContentObject(co);
82
83 document.getElementById('result').innerHTML = output;
84
85 }
86
87 function decode(){
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070088 var input = document.getElementById('result').innerHTML;
89
Meki Cherkaoui8f173612012-06-06 01:05:40 -070090 input = input.toUpperCase();
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070091
92 var co = decodeHexContentObject(input);
93
94 if(LOG>3)console.log('CONTENT OBJECT DECODED');
95 if(LOG>3)console.log(co);
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070096
jeffcc8b3a92012-09-03 15:13:27 -070097 document.getElementById('result').innerHTML = contentObjectToHtml(co);
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070098 }
99
100 </script>
101
102</head>
103<body >
104 <form>
105
106 Please Enter a Content Name:<br />
107
108 <input id="contentname" type="text" name="CONTENTNAME" value="/PARC/abc" />
109
Jeff Thompson12b029d2012-08-26 11:51:27 -0700110 <br />Please Enter the Content:<br />
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -0700111
112 <textarea id="content" cols="40" rows="5" name="CONTENT" value="SUCCESS" >SUCCESS!</textarea>
113
114 </form>
115 <button onclick="encode()">Encode</button>
116 <button onclick="decode()">Decode</button>
117
118
Jeff Thompson12b029d2012-08-26 11:51:27 -0700119 <p id="result"></p>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -0700120
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -0700121
122</body>
jeffcc8b3a92012-09-03 15:13:27 -0700123</html>