/security/nss/cmd/crmf-cgi/crmfcgi.html

http://github.com/zpao/v8monkey · HTML · 168 lines · 122 code · 11 blank · 35 comment · 0 complexity · 21401c99b8f88d2d07d75faea1b7f8ce MD5 · raw file

  1. <!-- ***** BEGIN LICENSE BLOCK *****
  2. - Version: MPL 1.1/GPL 2.0/LGPL 2.1
  3. -
  4. - The contents of this file are subject to the Mozilla Public License Version
  5. - 1.1 (the "License"); you may not use this file except in compliance with
  6. - the License. You may obtain a copy of the License at
  7. - http://www.mozilla.org/MPL/
  8. -
  9. - Software distributed under the License is distributed on an "AS IS" basis,
  10. - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  11. - for the specific language governing rights and limitations under the
  12. - License.
  13. -
  14. - The Original Code is the Netscape security libraries.
  15. -
  16. - The Initial Developer of the Original Code is
  17. - Netscape Communications Corporation.
  18. - Portions created by the Initial Developer are Copyright (C) 1994-2000
  19. - the Initial Developer. All Rights Reserved.
  20. -
  21. - Contributor(s):
  22. -
  23. - Alternatively, the contents of this file may be used under the terms of
  24. - either the GNU General Public License Version 2 or later (the "GPL"), or
  25. - the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  26. - in which case the provisions of the GPL or the LGPL are applicable instead
  27. - of those above. If you wish to allow use of your version of this file only
  28. - under the terms of either the GPL or the LGPL, and not to allow others to
  29. - use your version of this file under the terms of the MPL, indicate your
  30. - decision by deleting the provisions above and replace them with the notice
  31. - and other provisions required by the GPL or the LGPL. If you do not delete
  32. - the provisions above, a recipient may use your version of this file under
  33. - the terms of any one of the MPL, the GPL or the LGPL.
  34. -
  35. - ***** END LICENSE BLOCK ***** -->
  36. <html>
  37. <head>
  38. <title>CRMF Test Page for PSM</title>
  39. <script language=javascript>
  40. var request;
  41. //This variable must be set to the first value
  42. //in the select field "testType" in the form.
  43. var keyGenType="SigningOnlyRSA";
  44. var requestedDN = "CN=Javi CA Shack ID, O=NSS";
  45. function setTestType() {
  46. var testType = document.crmfForm.testType;
  47. keyGenType = testType.options[testType.selectedIndex].value;
  48. }
  49. function setRequest() {
  50. with (document.crmfForm) {
  51. CRMFRequest.value = request.request;
  52. submit();
  53. }
  54. }
  55. function generateSignAndEncryptRSARequest() {
  56. request = crypto.generateCRMFRequest(requestedDN,
  57. null, null, null, "setRequest()",
  58. crypto.algorithms.rsa.keyEx.keySizes[0],
  59. null, "rsa-dual-use");
  60. }
  61. function generateSigningOnlyRSARequest() {
  62. request = crypto.generateCRMFRequest(requestedDN,null,null,null,"setRequest()",
  63. crypto.algorithms.rsa.signing.keySizes[0],
  64. null, "rsa-sign");
  65. }
  66. function generateEncryptionOnlyRSARequest() {
  67. request = crypto.generateCRMFRequest(requestedDN, null, null, null, "setRequest()",
  68. crypto.algorithms.rsa.keyEx.keySizes[0],
  69. null, "rsa-ex");
  70. }
  71. function generateDualRSAKeys() {
  72. request = crypto.generateCRMFRequest(requestedDN, null, null, null, "setRequest()",
  73. crypto.algorithms.rsa.keyEx.keySizes[0],
  74. null, "rsa-ex",
  75. crypto.algorithms.rsa.signing.keySizes[0],
  76. null, "rsa-sign");
  77. }
  78. function generateDSAKey() {
  79. request = crypto.generateCRMFRequest(requestedDN, null, null, null, "setRequest()",
  80. crypto.algorithms.dsa.keySizes[0],
  81. null, "dsa-sign-nonrepudiation");
  82. }
  83. function processForm(form) {
  84. with (form) {
  85. if (typeof(crypto.version) == "undefined") {
  86. alert('You must be running PSM in order to use this page.');
  87. return false;
  88. }
  89. if (NSSDirectory.value == "") {
  90. alert('You must provide a path for NSS to use.');
  91. return false;
  92. }
  93. if (dbPassword.value == "") {
  94. alert('You must provide a password for the certificate database.');
  95. return false;
  96. }
  97. if (CANickname.value == "") {
  98. alert('You must provide a CA Nickname to use.');
  99. return false;
  100. }
  101. //Now do the correct key generation.
  102. if (keyGenType == "SignAndEncryptRSA") {
  103. generateSignAndEncryptRSARequest();
  104. } else if (keyGenType == "SigningOnlyRSA") {
  105. generateSigningOnlyRSARequest();
  106. } else if (keyGenType == "EncryptionOnlyRSA") {
  107. generateEncryptionOnlyRSARequest();
  108. } else if (keyGenType == "DualRSAKeys") {
  109. generateDualRSAKeys();
  110. } else if (keyGenType == "DSAKeyGen") {
  111. generateDSAKey();
  112. }
  113. }
  114. return true;
  115. }
  116. </script>
  117. </head>
  118. <body>
  119. <h1><center>CRMF Test page for PSM</center></h1>
  120. This page is designed to be used in combination with the executable
  121. produced by ns/security/cmd/crmf-cgi in a CGI environment. In order
  122. to successfully use this page, modify its action to post to a a server
  123. where you have installed the crmfcgi executable and you'll be able to
  124. test the functionality.
  125. <hr>
  126. <form name="crmfForm" method=post action="http://www.cgi-site.com/cgi-bin/crmfcgi">
  127. <h2>Certificate Database information</h2>
  128. First, enter all the information for the CGI to use for initializing
  129. NSS. The CGI will use the directory entered below as the directory
  130. where to look for the certificate and key databases.
  131. <pre>
  132. Path for NSS Config: <input size=40 type="text" name="NSSDirectory">
  133. </pre>
  134. Enter the password for the certificate database found in the direcotry
  135. above.
  136. <pre>
  137. Database Password: <input type="password" name="dbPassword" size=40>
  138. </pre>
  139. Now enter the nickname of the certificate to use for signing the
  140. certificate issued during this test.
  141. <pre>
  142. CA Nickname: <input size=40 type="text" name="CANickname">
  143. </pre>
  144. <h2>Now, figure out which type of key generation you want to test:</h2>
  145. <select name="testType" onChange="setTestType()">`
  146. <option value="SigningOnlyRSA">Signing Only-RSA
  147. <option value="EncryptionOnlyRSA">Encryption Only-RSA
  148. <option value="SignAndEncryptRSA">Sign and Encrypt Single Key -RSA
  149. <option value="DualRSAKeys">Dual Keys-RSA
  150. <option value="DSAKeyGen">DSA Key Gen
  151. </select>
  152. <input type="hidden" name=CRMFRequest value="">
  153. <hr>
  154. <input type="button" value="OK" onclick="processForm(document.crmfForm)">
  155. </form>
  156. </body>
  157. </html>