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

http://github.com/zpao/v8monkey · HTML · 87 lines · 22 code · 1 blank · 64 comment · 0 complexity · 442b5500f4d4873abf0366357b57d48a 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. <!--
  41. function submitSigned(form){
  42. var signature = "";
  43. var dataToSign = "";
  44. var i;
  45. form.action='signedForm.pl';
  46. for (i = 0; i < form.length; i++)
  47. if (form.elements[i].type == "text")
  48. dataToSign += form.elements[i].value;
  49. // alert("Data to sign:\n" + dataToSign);
  50. signature = crypto.signText(dataToSign, "ask");
  51. /* alert("You cannot see this alert");
  52. alert("Data signature:\n" + signature); */
  53. if (signature != "error:userCancel") {
  54. for (i = 0; i < form.length; i++) {
  55. if (form.elements[i].type == "hidden") {
  56. if (form.elements[i].name == "dataToSign")
  57. form.elements[i].value = dataToSign;
  58. if (form.elements[i].name == "dataSignature")
  59. form.elements[i].value = signature;
  60. }
  61. }
  62. form.submit();
  63. }
  64. }
  65. //-->
  66. </script>
  67. </head>
  68. <body>
  69. <form method=post Action="form.pl">
  70. <input type=hidden size=30 name=dataSignature>
  71. <input type=hidden size=30 name=dataToSign>
  72. <input type=text size=30 name=p>
  73. <BR>
  74. <input type=text size=30 name=q>
  75. <BR>
  76. <input type=text size=30 name=r>
  77. <BR>
  78. <input type=submit value="Submit Data">
  79. <input type=button value="Sign and Submit Data" onclick=submitSigned(this.form)>
  80. <input type=reset value=Reset>
  81. </form>
  82. </body>
  83. </html>