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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/security/nss/cmd/crmf-cgi/crmfcgi.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,136 @@
     1.4 +<!-- This Source Code Form is subject to the terms of the Mozilla Public
     1.5 +   - License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 +   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
     1.7 +
     1.8 +<html>
     1.9 +<head>
    1.10 +<title>CRMF Test Page for PSM</title>
    1.11 +<script language=javascript>
    1.12 +var request;
    1.13 +//This variable must be set to the first value
    1.14 +//in the select field "testType" in the form.
    1.15 +var keyGenType="SigningOnlyRSA";
    1.16 +
    1.17 +var requestedDN = "CN=Javi CA Shack ID, O=NSS";
    1.18 +
    1.19 +function setTestType() {
    1.20 +  var testType = document.crmfForm.testType;
    1.21 +  
    1.22 +  keyGenType = testType.options[testType.selectedIndex].value;
    1.23 +}
    1.24 +
    1.25 +function setRequest() {
    1.26 +  with (document.crmfForm) {
    1.27 +    CRMFRequest.value = request.request;
    1.28 +    submit();
    1.29 +  }
    1.30 +}
    1.31 +
    1.32 +function generateSignAndEncryptRSARequest() {
    1.33 +    request = crypto.generateCRMFRequest(requestedDN,
    1.34 +                                         null, null, null, "setRequest()",
    1.35 +                                         crypto.algorithms.rsa.keyEx.keySizes[0],
    1.36 +                                         null, "rsa-dual-use");    
    1.37 +}
    1.38 +
    1.39 +function generateSigningOnlyRSARequest() {
    1.40 +    request = crypto.generateCRMFRequest(requestedDN,null,null,null,"setRequest()",
    1.41 +                                         crypto.algorithms.rsa.signing.keySizes[0],
    1.42 +                                         null, "rsa-sign");
    1.43 +}
    1.44 +
    1.45 +function generateEncryptionOnlyRSARequest() {
    1.46 +    request = crypto.generateCRMFRequest(requestedDN, null, null, null, "setRequest()",
    1.47 +                                         crypto.algorithms.rsa.keyEx.keySizes[0],
    1.48 +                                         null, "rsa-ex");
    1.49 +}
    1.50 +
    1.51 +function generateDualRSAKeys() {
    1.52 +    request = crypto.generateCRMFRequest(requestedDN, null, null, null, "setRequest()",
    1.53 +                                         crypto.algorithms.rsa.keyEx.keySizes[0],
    1.54 +                                         null, "rsa-ex",
    1.55 +                                         crypto.algorithms.rsa.signing.keySizes[0],
    1.56 +                                         null, "rsa-sign");
    1.57 +}
    1.58 +
    1.59 +function generateDSAKey() {
    1.60 +    request = crypto.generateCRMFRequest(requestedDN, null, null, null, "setRequest()",
    1.61 +                                         crypto.algorithms.dsa.keySizes[0],
    1.62 +                                         null, "dsa-sign-nonrepudiation");
    1.63 +}
    1.64 +
    1.65 +function processForm(form) {
    1.66 +  with (form) {
    1.67 +    if (typeof(crypto.version) == "undefined") {
    1.68 +      alert('You must be running PSM in order to use this page.');
    1.69 +      return false;
    1.70 +    }
    1.71 +    if (NSSDirectory.value == "") {
    1.72 +      alert('You must provide a path for NSS to use.');
    1.73 +      return false;
    1.74 +    }
    1.75 +    if (dbPassword.value == "") {
    1.76 +      alert('You must provide a password for the certificate database.');
    1.77 +      return false;
    1.78 +    }
    1.79 +    if (CANickname.value == "") {
    1.80 +      alert('You must provide a CA Nickname to use.');
    1.81 +      return false;
    1.82 +    }
    1.83 +    //Now do the correct key generation.
    1.84 +    if (keyGenType == "SignAndEncryptRSA") {
    1.85 +      generateSignAndEncryptRSARequest();
    1.86 +    } else if (keyGenType == "SigningOnlyRSA") {
    1.87 +      generateSigningOnlyRSARequest();
    1.88 +    } else if (keyGenType == "EncryptionOnlyRSA") {
    1.89 +      generateEncryptionOnlyRSARequest();
    1.90 +    } else if (keyGenType == "DualRSAKeys") {
    1.91 +      generateDualRSAKeys();
    1.92 +    } else if (keyGenType == "DSAKeyGen") {
    1.93 +      generateDSAKey();
    1.94 +    }
    1.95 +  }
    1.96 +  return true;
    1.97 +}
    1.98 +</script>
    1.99 +</head>
   1.100 +<body>
   1.101 +<h1><center>CRMF Test page for PSM</center></h1>
   1.102 +This page is designed to be used in combination with the executable
   1.103 +produced by ns/security/cmd/crmf-cgi in a CGI environment.  In order
   1.104 +to successfully use this page, modify its action to post to a a server
   1.105 +where you have installed the crmfcgi executable and you'll be able to
   1.106 +test the functionality.
   1.107 +<hr>
   1.108 +<form name="crmfForm" method=post action="http://www.cgi-site.com/cgi-bin/crmfcgi"> 
   1.109 +<h2>Certificate Database information</h2>
   1.110 +First, enter all the information for the CGI to use for initializing 
   1.111 +NSS.  The CGI will use the directory entered below as the directory
   1.112 +where to look for the certificate and key databases.
   1.113 +<pre>
   1.114 +Path for NSS Config: <input size=40 type="text" name="NSSDirectory">
   1.115 +</pre>
   1.116 +Enter the password for the certificate database found in the direcotry
   1.117 +above.
   1.118 +<pre>
   1.119 +Database Password:   <input type="password" name="dbPassword" size=40>
   1.120 +</pre>
   1.121 +Now enter the nickname of the certificate to use for signing the 
   1.122 +certificate issued during this test.
   1.123 +<pre>
   1.124 +CA Nickname:         <input size=40 type="text" name="CANickname">
   1.125 +</pre>
   1.126 +<h2>Now, figure out which type of key generation you want to test:</h2>
   1.127 +<select name="testType" onChange="setTestType()">`
   1.128 +<option value="SigningOnlyRSA">Signing Only-RSA
   1.129 +<option value="EncryptionOnlyRSA">Encryption Only-RSA
   1.130 +<option value="SignAndEncryptRSA">Sign and Encrypt Single Key -RSA
   1.131 +<option value="DualRSAKeys">Dual Keys-RSA
   1.132 +<option value="DSAKeyGen">DSA Key Gen
   1.133 +</select>
   1.134 +<input type="hidden" name=CRMFRequest value="">
   1.135 +<hr>
   1.136 +<input type="button" value="OK" onclick="processForm(document.crmfForm)">
   1.137 +</form>
   1.138 +</body>
   1.139 +</html>

mercurial