PageRenderTime 17ms CodeModel.GetById 9ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/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
 37<html>
 38<head>
 39<title>CRMF Test Page for PSM</title>
 40<script language=javascript>
 41var request;
 42//This variable must be set to the first value
 43//in the select field "testType" in the form.
 44var keyGenType="SigningOnlyRSA";
 45
 46var requestedDN = "CN=Javi CA Shack ID, O=NSS";
 47
 48function setTestType() {
 49  var testType = document.crmfForm.testType;
 50  
 51  keyGenType = testType.options[testType.selectedIndex].value;
 52}
 53
 54function setRequest() {
 55  with (document.crmfForm) {
 56    CRMFRequest.value = request.request;
 57    submit();
 58  }
 59}
 60
 61function generateSignAndEncryptRSARequest() {
 62    request = crypto.generateCRMFRequest(requestedDN,
 63                                         null, null, null, "setRequest()",
 64                                         crypto.algorithms.rsa.keyEx.keySizes[0],
 65                                         null, "rsa-dual-use");    
 66}
 67
 68function generateSigningOnlyRSARequest() {
 69    request = crypto.generateCRMFRequest(requestedDN,null,null,null,"setRequest()",
 70                                         crypto.algorithms.rsa.signing.keySizes[0],
 71                                         null, "rsa-sign");
 72}
 73
 74function generateEncryptionOnlyRSARequest() {
 75    request = crypto.generateCRMFRequest(requestedDN, null, null, null, "setRequest()",
 76                                         crypto.algorithms.rsa.keyEx.keySizes[0],
 77                                         null, "rsa-ex");
 78}
 79
 80function generateDualRSAKeys() {
 81    request = crypto.generateCRMFRequest(requestedDN, null, null, null, "setRequest()",
 82                                         crypto.algorithms.rsa.keyEx.keySizes[0],
 83                                         null, "rsa-ex",
 84                                         crypto.algorithms.rsa.signing.keySizes[0],
 85                                         null, "rsa-sign");
 86}
 87
 88function generateDSAKey() {
 89    request = crypto.generateCRMFRequest(requestedDN, null, null, null, "setRequest()",
 90                                         crypto.algorithms.dsa.keySizes[0],
 91                                         null, "dsa-sign-nonrepudiation");
 92}
 93
 94function processForm(form) {
 95  with (form) {
 96    if (typeof(crypto.version) == "undefined") {
 97      alert('You must be running PSM in order to use this page.');
 98      return false;
 99    }
100    if (NSSDirectory.value == "") {
101      alert('You must provide a path for NSS to use.');
102      return false;
103    }
104    if (dbPassword.value == "") {
105      alert('You must provide a password for the certificate database.');
106      return false;
107    }
108    if (CANickname.value == "") {
109      alert('You must provide a CA Nickname to use.');
110      return false;
111    }
112    //Now do the correct key generation.
113    if (keyGenType == "SignAndEncryptRSA") {
114      generateSignAndEncryptRSARequest();
115    } else if (keyGenType == "SigningOnlyRSA") {
116      generateSigningOnlyRSARequest();
117    } else if (keyGenType == "EncryptionOnlyRSA") {
118      generateEncryptionOnlyRSARequest();
119    } else if (keyGenType == "DualRSAKeys") {
120      generateDualRSAKeys();
121    } else if (keyGenType == "DSAKeyGen") {
122      generateDSAKey();
123    }
124  }
125  return true;
126}
127</script>
128</head>
129<body>
130<h1><center>CRMF Test page for PSM</center></h1>
131This page is designed to be used in combination with the executable
132produced by ns/security/cmd/crmf-cgi in a CGI environment.  In order
133to successfully use this page, modify its action to post to a a server
134where you have installed the crmfcgi executable and you'll be able to
135test the functionality.
136<hr>
137<form name="crmfForm" method=post action="http://www.cgi-site.com/cgi-bin/crmfcgi"> 
138<h2>Certificate Database information</h2>
139First, enter all the information for the CGI to use for initializing 
140NSS.  The CGI will use the directory entered below as the directory
141where to look for the certificate and key databases.
142<pre>
143Path for NSS Config: <input size=40 type="text" name="NSSDirectory">
144</pre>
145Enter the password for the certificate database found in the direcotry
146above.
147<pre>
148Database Password:   <input type="password" name="dbPassword" size=40>
149</pre>
150Now enter the nickname of the certificate to use for signing the 
151certificate issued during this test.
152<pre>
153CA Nickname:         <input size=40 type="text" name="CANickname">
154</pre>
155<h2>Now, figure out which type of key generation you want to test:</h2>
156<select name="testType" onChange="setTestType()">`
157<option value="SigningOnlyRSA">Signing Only-RSA
158<option value="EncryptionOnlyRSA">Encryption Only-RSA
159<option value="SignAndEncryptRSA">Sign and Encrypt Single Key -RSA
160<option value="DualRSAKeys">Dual Keys-RSA
161<option value="DSAKeyGen">DSA Key Gen
162</select>
163<input type="hidden" name=CRMFRequest value="">
164<hr>
165<input type="button" value="OK" onclick="processForm(document.crmfForm)">
166</form>
167</body>
168</html>