blob: ac48e3f1e613ae7703984c14e1e4c3cd7e5a129b (
plain)
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
|
<html>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<head>
<title>Form to sign</title>
<script language="javascript">
<!--
function submitSigned(form){
var signature = "";
var dataToSign = "";
var i;
form.action='signedForm.pl';
for (i = 0; i < form.length; i++)
if (form.elements[i].type == "text")
dataToSign += form.elements[i].value;
// alert("Data to sign:\n" + dataToSign);
signature = crypto.signText(dataToSign, "ask");
/* alert("You cannot see this alert");
alert("Data signature:\n" + signature); */
if (signature != "error:userCancel") {
for (i = 0; i < form.length; i++) {
if (form.elements[i].type == "hidden") {
if (form.elements[i].name == "dataToSign")
form.elements[i].value = dataToSign;
if (form.elements[i].name == "dataSignature")
form.elements[i].value = signature;
}
}
form.submit();
}
}
//-->
</script>
</head>
<body>
<form method=post Action="form.pl">
<input type=hidden size=30 name=dataSignature>
<input type=hidden size=30 name=dataToSign>
<input type=text size=30 name=p>
<BR>
<input type=text size=30 name=q>
<BR>
<input type=text size=30 name=r>
<BR>
<input type=submit value="Submit Data">
<input type=button value="Sign and Submit Data" onclick=submitSigned(this.form)>
<input type=reset value=Reset>
</form>
</body>
</html>
|