PageRenderTime 27ms CodeModel.GetById 22ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/security/nss/cmd/signver/examples/1/signedForm.nt.html

http://github.com/zpao/v8monkey
HTML | 87 lines | 22 code | 1 blank | 64 comment | 0 complexity | c1a9d0907b90d40c9e68d71ed42d6a39 MD5 | raw file
 1<html>
 2<!-- ***** BEGIN LICENSE BLOCK *****
 3   - Version: MPL 1.1/GPL 2.0/LGPL 2.1
 4   -
 5   - The contents of this file are subject to the Mozilla Public License Version
 6   - 1.1 (the "License"); you may not use this file except in compliance with
 7   - the License. You may obtain a copy of the License at
 8   - http://www.mozilla.org/MPL/
 9   -
10   - Software distributed under the License is distributed on an "AS IS" basis,
11   - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12   - for the specific language governing rights and limitations under the
13   - License.
14   -
15   - The Original Code is the Netscape security libraries.
16   -
17   - The Initial Developer of the Original Code is
18   - Netscape Communications Corporation.
19   - Portions created by the Initial Developer are Copyright (C) 1994-2000
20   - the Initial Developer. All Rights Reserved.
21   -
22   - Contributor(s):
23   -
24   - Alternatively, the contents of this file may be used under the terms of
25   - either the GNU General Public License Version 2 or later (the "GPL"), or
26   - the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27   - in which case the provisions of the GPL or the LGPL are applicable instead
28   - of those above. If you wish to allow use of your version of this file only
29   - under the terms of either the GPL or the LGPL, and not to allow others to
30   - use your version of this file under the terms of the MPL, indicate your
31   - decision by deleting the provisions above and replace them with the notice
32   - and other provisions required by the GPL or the LGPL. If you do not delete
33   - the provisions above, a recipient may use your version of this file under
34   - the terms of any one of the MPL, the GPL or the LGPL.
35   -
36   - ***** END LICENSE BLOCK ***** -->
37<head>
38<title>Form to sign</title>
39<script language="javascript">
40<!--
41function submitSigned(form){
42  var signature = "";
43  var dataToSign = "";
44  var i;
45
46  form.action='cgi-bin/signedForm.pl';
47  for (i = 0; i < form.length; i++)
48    if (form.elements[i].type == "text")
49      dataToSign += form.elements[i].value;
50
51  // alert("Data to sign:\n" + dataToSign);
52  signature = crypto.signText(dataToSign, "ask");
53  /* alert("You cannot see this alert");
54  alert("Data signature:\n" + signature); */
55
56  if (signature != "error:userCancel") {
57    for (i = 0; i < form.length; i++) {
58      if (form.elements[i].type == "hidden") {
59        if (form.elements[i].name == "dataToSign")
60          form.elements[i].value = dataToSign;
61        if (form.elements[i].name == "dataSignature")
62          form.elements[i].value = signature;
63      }
64    }
65    form.submit();
66  }
67}
68//-->
69</script>
70</head>
71
72<body>
73<form method=post Action="cgi-bin/form.pl">
74<input type=hidden size=30 name=dataSignature>
75<input type=hidden size=30 name=dataToSign>
76<input type=text size=30 name=p>
77<BR>
78<input type=text size=30 name=q>
79<BR>
80<input type=text size=30 name=r>
81<BR>
82<input type=submit value="Submit Data">
83<input type=button value="Sign and Submit Data" onclick=submitSigned(this.form)>
84<input type=reset value=Reset>
85</form>
86</body>
87</html>