1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/nss/cmd/signver/examples/1/signedForm.nt.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,55 @@ 1.4 +<html> 1.5 +<!-- This Source Code Form is subject to the terms of the Mozilla Public 1.6 + - License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> 1.8 +<head> 1.9 +<title>Form to sign</title> 1.10 +<script language="javascript"> 1.11 +<!-- 1.12 +function submitSigned(form){ 1.13 + var signature = ""; 1.14 + var dataToSign = ""; 1.15 + var i; 1.16 + 1.17 + form.action='cgi-bin/signedForm.pl'; 1.18 + for (i = 0; i < form.length; i++) 1.19 + if (form.elements[i].type == "text") 1.20 + dataToSign += form.elements[i].value; 1.21 + 1.22 + // alert("Data to sign:\n" + dataToSign); 1.23 + signature = crypto.signText(dataToSign, "ask"); 1.24 + /* alert("You cannot see this alert"); 1.25 + alert("Data signature:\n" + signature); */ 1.26 + 1.27 + if (signature != "error:userCancel") { 1.28 + for (i = 0; i < form.length; i++) { 1.29 + if (form.elements[i].type == "hidden") { 1.30 + if (form.elements[i].name == "dataToSign") 1.31 + form.elements[i].value = dataToSign; 1.32 + if (form.elements[i].name == "dataSignature") 1.33 + form.elements[i].value = signature; 1.34 + } 1.35 + } 1.36 + form.submit(); 1.37 + } 1.38 +} 1.39 +//--> 1.40 +</script> 1.41 +</head> 1.42 + 1.43 +<body> 1.44 +<form method=post Action="cgi-bin/form.pl"> 1.45 +<input type=hidden size=30 name=dataSignature> 1.46 +<input type=hidden size=30 name=dataToSign> 1.47 +<input type=text size=30 name=p> 1.48 +<BR> 1.49 +<input type=text size=30 name=q> 1.50 +<BR> 1.51 +<input type=text size=30 name=r> 1.52 +<BR> 1.53 +<input type=submit value="Submit Data"> 1.54 +<input type=button value="Sign and Submit Data" onclick=submitSigned(this.form)> 1.55 +<input type=reset value=Reset> 1.56 +</form> 1.57 +</body> 1.58 +</html>