|
1 <!-- This Source Code Form is subject to the terms of the Mozilla Public |
|
2 - License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> |
|
4 |
|
5 <html> |
|
6 <head> |
|
7 <title>CRMF Test Page for PSM</title> |
|
8 <script language=javascript> |
|
9 var request; |
|
10 //This variable must be set to the first value |
|
11 //in the select field "testType" in the form. |
|
12 var keyGenType="SigningOnlyRSA"; |
|
13 |
|
14 var requestedDN = "CN=Javi CA Shack ID, O=NSS"; |
|
15 |
|
16 function setTestType() { |
|
17 var testType = document.crmfForm.testType; |
|
18 |
|
19 keyGenType = testType.options[testType.selectedIndex].value; |
|
20 } |
|
21 |
|
22 function setRequest() { |
|
23 with (document.crmfForm) { |
|
24 CRMFRequest.value = request.request; |
|
25 submit(); |
|
26 } |
|
27 } |
|
28 |
|
29 function generateSignAndEncryptRSARequest() { |
|
30 request = crypto.generateCRMFRequest(requestedDN, |
|
31 null, null, null, "setRequest()", |
|
32 crypto.algorithms.rsa.keyEx.keySizes[0], |
|
33 null, "rsa-dual-use"); |
|
34 } |
|
35 |
|
36 function generateSigningOnlyRSARequest() { |
|
37 request = crypto.generateCRMFRequest(requestedDN,null,null,null,"setRequest()", |
|
38 crypto.algorithms.rsa.signing.keySizes[0], |
|
39 null, "rsa-sign"); |
|
40 } |
|
41 |
|
42 function generateEncryptionOnlyRSARequest() { |
|
43 request = crypto.generateCRMFRequest(requestedDN, null, null, null, "setRequest()", |
|
44 crypto.algorithms.rsa.keyEx.keySizes[0], |
|
45 null, "rsa-ex"); |
|
46 } |
|
47 |
|
48 function generateDualRSAKeys() { |
|
49 request = crypto.generateCRMFRequest(requestedDN, null, null, null, "setRequest()", |
|
50 crypto.algorithms.rsa.keyEx.keySizes[0], |
|
51 null, "rsa-ex", |
|
52 crypto.algorithms.rsa.signing.keySizes[0], |
|
53 null, "rsa-sign"); |
|
54 } |
|
55 |
|
56 function generateDSAKey() { |
|
57 request = crypto.generateCRMFRequest(requestedDN, null, null, null, "setRequest()", |
|
58 crypto.algorithms.dsa.keySizes[0], |
|
59 null, "dsa-sign-nonrepudiation"); |
|
60 } |
|
61 |
|
62 function processForm(form) { |
|
63 with (form) { |
|
64 if (typeof(crypto.version) == "undefined") { |
|
65 alert('You must be running PSM in order to use this page.'); |
|
66 return false; |
|
67 } |
|
68 if (NSSDirectory.value == "") { |
|
69 alert('You must provide a path for NSS to use.'); |
|
70 return false; |
|
71 } |
|
72 if (dbPassword.value == "") { |
|
73 alert('You must provide a password for the certificate database.'); |
|
74 return false; |
|
75 } |
|
76 if (CANickname.value == "") { |
|
77 alert('You must provide a CA Nickname to use.'); |
|
78 return false; |
|
79 } |
|
80 //Now do the correct key generation. |
|
81 if (keyGenType == "SignAndEncryptRSA") { |
|
82 generateSignAndEncryptRSARequest(); |
|
83 } else if (keyGenType == "SigningOnlyRSA") { |
|
84 generateSigningOnlyRSARequest(); |
|
85 } else if (keyGenType == "EncryptionOnlyRSA") { |
|
86 generateEncryptionOnlyRSARequest(); |
|
87 } else if (keyGenType == "DualRSAKeys") { |
|
88 generateDualRSAKeys(); |
|
89 } else if (keyGenType == "DSAKeyGen") { |
|
90 generateDSAKey(); |
|
91 } |
|
92 } |
|
93 return true; |
|
94 } |
|
95 </script> |
|
96 </head> |
|
97 <body> |
|
98 <h1><center>CRMF Test page for PSM</center></h1> |
|
99 This page is designed to be used in combination with the executable |
|
100 produced by ns/security/cmd/crmf-cgi in a CGI environment. In order |
|
101 to successfully use this page, modify its action to post to a a server |
|
102 where you have installed the crmfcgi executable and you'll be able to |
|
103 test the functionality. |
|
104 <hr> |
|
105 <form name="crmfForm" method=post action="http://www.cgi-site.com/cgi-bin/crmfcgi"> |
|
106 <h2>Certificate Database information</h2> |
|
107 First, enter all the information for the CGI to use for initializing |
|
108 NSS. The CGI will use the directory entered below as the directory |
|
109 where to look for the certificate and key databases. |
|
110 <pre> |
|
111 Path for NSS Config: <input size=40 type="text" name="NSSDirectory"> |
|
112 </pre> |
|
113 Enter the password for the certificate database found in the direcotry |
|
114 above. |
|
115 <pre> |
|
116 Database Password: <input type="password" name="dbPassword" size=40> |
|
117 </pre> |
|
118 Now enter the nickname of the certificate to use for signing the |
|
119 certificate issued during this test. |
|
120 <pre> |
|
121 CA Nickname: <input size=40 type="text" name="CANickname"> |
|
122 </pre> |
|
123 <h2>Now, figure out which type of key generation you want to test:</h2> |
|
124 <select name="testType" onChange="setTestType()">` |
|
125 <option value="SigningOnlyRSA">Signing Only-RSA |
|
126 <option value="EncryptionOnlyRSA">Encryption Only-RSA |
|
127 <option value="SignAndEncryptRSA">Sign and Encrypt Single Key -RSA |
|
128 <option value="DualRSAKeys">Dual Keys-RSA |
|
129 <option value="DSAKeyGen">DSA Key Gen |
|
130 </select> |
|
131 <input type="hidden" name=CRMFRequest value=""> |
|
132 <hr> |
|
133 <input type="button" value="OK" onclick="processForm(document.crmfForm)"> |
|
134 </form> |
|
135 </body> |
|
136 </html> |