-
Notifications
You must be signed in to change notification settings - Fork 13
/
form_main.html
239 lines (206 loc) · 13.5 KB
/
form_main.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
<!DOCTYPE html>
<html>
<head>
<title>PKI infrastructure</title>
<meta charset="utf-8">
<meta name="description" content="WebRTC code samples">
<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1, maximum-scale=1">
<meta itemprop="description" content="Client-side WebRTC code samples">
<meta itemprop="name" content="WebRTC code samples">
<meta name="mobile-web-app-capable" content="yes">
<meta id="theme-color" name="theme-color" content="#ffffff">
<link rel="stylesheet" type="text/css" href="public/app.css">
<link rel="stylesheet" href="public/css/main.css">
</head>
<body>
<img src="public/snt.png" align="right">
<br>
<br>
<br>
<br>
<h1>PKI infrastructure over Blockchain </h1>
<hr>
<title>PKI infrastructure test</title>
<script>
/*
// Check for the various File API support.
if (window.File && window.FileReader && window.FileList) {
// Great success! All the File APIs are supported.
} else {
alert('The File APIs are not fully supported in this browser.');
}
var serversocket = new WebSocket("ws://localhost:8080/echo");
serversocket.onopen = function() {
serversocket.send("Connection init");
}
// Write message on receive
serversocket.onmessage = function(e) {
//document.getElementById('comms').innerHTML += "Received: " + e.data + "<br>";
if e.data == "reload" {
window.location.reload(true);
}
};
function handleFileSelect(evt) {
var files = evt.target.UplFiles; // FileList object
alert("I'm here")
// files is a FileList of File objects. List some properties.
var output = [];
for (var i = 0, f; f = files[i]; i++) {
output.push('<li><strong>', escape(f.name), '</strong> (', f.type || 'n/a', ') - ',
f.size, ' bytes, last modified: ',
f.lastModifiedDate ? f.lastModifiedDate.toLocaleDateString() : 'n/a',
'</li>');
}
document.getElementById('list').innerHTML = '<ul>' + output.join('') + '</ul>';
}
document.getElementById('UplFiles').addEventListener('change', handleFileSelect, false);
*/
</script>
<body>
{{ $vSuperUserAddr := .SuperUserAddr }}
<br><br>
<h1> Certificate Authority (CA) : {{.ParentAddr}} </h1>
<p>
Parent of this CA (zero if the root) : {{.SuperParentAddr}}
<p>
Account address : {{ $vSuperUserAddr }}
<p>
<form enctype="multipart/form-data" name="DownloadCert" action="/download_cacert" method="post">
<input type="hidden" name="ContrAddr" value="{{.ParentAddr}}">
<input type="submit" class="button button2" name="DownloadCertButton" value="Download Certificate of this CA">
</form>
{{if not .IsRoot}}
<form enctype="multipart/form-data" name="ParentForm" action="/pki-test" method="post" target="_self">
<input type="hidden" name="ParentAddr" value="{{ .SuperParentAddr }}">
<input type="submit" class="button button2" name="EditCAButton" value="Go to parent contract">
</form>
{{end}} {{if .IsRoot}}
<form enctype="multipart/form-data" name="PopulateCurrentRequest" action="/populate_contract" method="post" target="_self">
<input type="hidden" name="ContrAddr" value="{{.ParentAddr}}">
<input type="submit" class="button button2" name="PopulateCurrentButton" value="Populate Root Contract">
</form>
{{end}}
<br><br>
<table border="1">
<tr>
<th>Attributes and description</th>
<th>Time of uploading</th>
<th>Key file</th>
<th>Hash</th>
<th>REVOCATION</th>
<th>EDIT CA</th>
</tr>
{{range $doc := .Docs }}
<tr>
<td>
{{if $doc.IsCA}} {{$doc.ContrAddr}} {{else}} {{$doc.Desc }} {{end}}
</td>
<td>{{ $doc.CreationStr }}</td>
<td>{{ $doc.Name }}</td>
<td>{{ $doc.Hash }}</td>
<td>
<form enctype="multipart/form-data" name="Rev{{$doc.Id}}" action="/blacklist_user" method="post" target="_self">
<!--input type="hidden" name="Deletion" value="{{ $doc.Id }}"-->
<input type="hidden" name="Deletion" value="{{ $doc.Hash }}">
<input type="hidden" name="ParentAddr" value="{{$doc.ParentAddr}}">
<input type="hidden" name="UserAddr" value="{{ $vSuperUserAddr }}">
<input type="submit" class="button button3" name="DeleteButton" value="Revoke">
</form>
</td>
<td>
{{if $doc.IsCA}}
<form enctype="multipart/form-data" name="Edi{{$doc.Id}}" action="/pki-test" method="post" target="_self">
<input type="hidden" name="SuperParentAddr" value="{{ $doc.ParentAddr }}">
<input type="hidden" name="ParentAddr" value="{{ $doc.ContrAddr }}">
<input type="hidden" name="UserAddr" value="{{ $doc.UserAddr }}">
<input type="submit" class="button button3" name="EditCAButton" value="Edit">
</form>
{{end}}
</td>
</tr>
{{end}}
</table>
<form enctype="multipart/form-data" name="RevokeListRequest" action="/pki-test" method="post" target="_self">
<input type="hidden" name="SuperParentAddr" value="{{ .SuperParentAddr }}">
<input type="hidden" name="ParentAddr" value="{{ .ParentAddr }}">
<input type="submit" class="button button3" name="RevokeListButton" value="Show Revocation List" populate_contract>
</form>
<p>
<table border="1">
<table border="0">
<tr>
<form enctype="multipart/form-data" name="ValidateCert" action="/validate_form" method="post" target="_self">
<input type="hidden" name="ParentAddr" value="{{.ParentAddr}}">
<input type="submit" class="button button2" name="ValidateCertButton" value="Upload and Validate Certificate">
</form>
</tr>
<tr>
<form enctype="multipart/form-data" name="ValidateCertHash" action="/validate_cert" method="post" target="_self">
<input type="hidden" name="ParentAddr" value="{{.ParentAddr}}"> Enter Certificate's hash <input type="text" name="Hash">
<input type="submit" class="button button2" name="ValidateCertButton" value="Validate Certificate's hash">
</form>
</tr>
</table>
</table>
<p>
<form enctype="multipart/form-data" name="NewACRequest" action="/create_contract" method="post" target="_self">
Enter subCA user address <input type="text" name="NewUserAddr">
<input type="hidden" name="CurrentUserAddr" value="{{.SuperUserAddr}}">
<input type="hidden" name="ParentAddr" value="{{.ParentAddr}}">
<input type="submit" class="button button2" name="NewContrButton" value="New subCA">
</form>
<p> <br>
<table border="1">
<tr>
<td>
<form enctype="multipart/form-data" name="GenerateUserCert" action="/generate_user_cert" method="post">
<table border="0">
<tr>
<td>
TESTING: end user certificate generation for this contract
</td>
</tr>
<tr>
<td> End user name (for the certificate) <input type="text" name="Name"> </td>
</tr>
</table>
<input type="hidden" name="InsertAddr" value="{{.ParentAddr}}">
<input type="submit" class="button button2" name="AddButton" value="Generate certificate">
</form>
</td>
</tr>
</table>
<p> <br>
<table border="1">
<tr>
<td>
<form enctype="multipart/form-data" name="DocUpload" action="/enroll_user" method="post" target="_self">
<table border="0">
<tr>
<td>
With the button below please pick the certificate to add to the white list
</td>
</tr>
<!--
<tr><td> Description <input type="text" name="Desc"> </td></tr>
<tr><td>
<input type="checkbox" name="Encryption" value="Encrypt">To encrypt
</tr></td> -->
<tr>
<td>
<input type="file" id="UplFiles" name="UplFiles" multiple>
</td>
</tr>
</table>
<input type="hidden" name="ParentAddr" value="{{.ParentAddr}}">
<input type="hidden" name="CurrentUserAddr" value="{{.SuperUserAddr}}">
<input type="submit" class="button button2" class="button button2" name="AddButton" value="Upload document">
<output id="list"> </output>
</form>
</td>
</tr>
</table>
<hr>
<p style="text-align:center;">PKI infrastructure over Blockchain Prototype</p>
</body>
</html>