summaryrefslogtreecommitdiffstats
path: root/base/common/shared/webapps/pki/admin/console/config/adminpanel.vm
blob: 37d922764be3523fac3eef08f45af363a143ff37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<!-- --- BEGIN COPYRIGHT BLOCK ---
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
     the Free Software Foundation; version 2 of the License.

     This program is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     GNU General Public License for more details.

     You should have received a copy of the GNU General Public License along
     with this program; if not, write to the Free Software Foundation, Inc.,
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

     Copyright (C) 2007 Red Hat, Inc.
     All rights reserved.
     --- END COPYRIGHT BLOCK --- -->

<SCRIPT ID=Send_OnClick type="text/JavaScript">
function myOnLoad() {
}

function performPanel() {
    var email = document.forms[0].email.value;
    var name = document.forms[0].name.value;
    var o = '$securityDomain';
    if (name == '') {
        alert("Name is empty");
        return;
    }
    if (email == '') {
        alert("Email is empty");
        return;
    }
    var dn = "cn=" + name + ",uid=admin,e="+email+",o="+o;
    document.forms[0].subject.value = dn;
    var keyGenAlg = "rsa-dual-use";
    var keyParams = null;
    if (document.forms[0].keytype.value == 'ecc') {
        keyGenAlg = "ec-dual-use";
        keyParams = "curve=nistp256"
    }

    if (navigator.appName == "Netscape" &&
      typeof(crypto.version) != "undefined") {

        crmfObject = crypto.generateCRMFRequest(
          dn, "regToken", "authenticator", null,
          "setCRMFRequest();", 2048, keyParams, keyGenAlg);
    } else {
        Send_OnClick();
    }
}

function setCRMFRequest()
{
    with (document.forms[0]) {
        cert_request.value = crmfObject.request;
        submit();
    }
}

</SCRIPT>
<SCRIPT type="text/VBS">
<!--

Sub Send_OnClick
  Dim TheForm
  Dim szName
  Set TheForm = Document.f


  ' Contruct the X500 distinguished name
  szName = "CN=NAME"

  ' IE doesnt like the dn containing the O component

  On Error Resume Next
  Enroll.HashAlgorithm = "MD5"
  Enroll.KeySpec = 1

   Enroll.providerType = 1
   Enroll.providerName = "Microsoft Base Cryptographic Provider v1.0"

   ' adding 2 to "GenKeyFlags" will  enable the 'High Security'
   ' (USER_PROTECTED) mode, which means IE will pop up a dialog
   ' asking what level of protection the user would like to give
   ' the key - this varies from 'none' to 'confirm password
   ' every time the key is used'
  Enroll.GenKeyFlags = 1        ' key PKCS12-exportable
  szCertReq = Enroll.createPKCS10(szName, "1.3.6.1.5.5.7.3.2")

  theError = Err.Number
  On Error Goto 0
  '
  ' If the user has cancelled things the we simply ignore whatever
  ' they were doing ... need to think what should be done here
  '
  If (szCertReq = Empty AND theError = 0) Then
    Exit Sub
  End If
  If (szCertReq = Empty OR theError <> 0) Then
    '
    ' There was an error in the key pair generation. The error value
    ' is found in the variable 'theError' which we snarfed above before
    ' we did the 'On Error Goto 0' which cleared it again.
    '
    sz = "The error '" & Hex(theError) & "' occurred." & chr(13) & chr(10) & "The credentials could not be generated."
    result = MsgBox(sz, 0, "Credentials Enrollment")
    Exit Sub
  End If

  TheForm.cert_request.Value = szCertReq
  TheForm.cert_request_type.Value = "pkcs10"
  TheForm.subject.Value = "cn=" & TheForm.name.Value & ",uid=" & TheForm.uid.Value & ",e=" & TheForm.email.Value & ",o=" & TheForm.securitydomain.Value

  TheForm.Submit
  Exit Sub

End Sub

-->
</SCRIPT>

<SCRIPT type="text/VBS">
<!--
FindProviders

Function FindProviders
        Dim i, j
        Dim providers()
        i = 0
        j = 1
        Dim el
        Dim temp
        Dim first
        Dim TheForm
        Set TheForm = document.f
        On Error Resume Next
        first = 0

        Do While True
        temp = ""
        Enroll.providerType = j
        temp = Enroll.enumProviders(i,0)
        If Len(temp) = 0 Then
        If j < 1 Then
          j = j + 1
          i = 0
        Else
          Exit Do
        End If
        Else
        set el = document.createElement("OPTION")
        el.text = temp
        el.value = j
        If temp = "Microsoft Base Cryptographic Provider v1.0" Then
          first = j
        End If
        TheForm.cryptprovider.add(el)
        If first = 0  Then
          first = 1
          TheForm.cryptprovider.selectedIndex = 0
        Else
          TheForm.cryptprovider.selectedIndex = first
        End If
        i = i + 1
        End If
        Loop
End Function

-->
</SCRIPT>
The administrator is a privileged user who manages this subsystem. Please enter the following relevant information, and a certificate request will be automatically generated and submitted. An administrator's entry will be created in the internal database and an administrator's certificate will be imported into this browser automatically in the next panel.
<br/>
#if ($errorString != "")
<img src="/pki/images/icon_crit_update.gif">&nbsp;<font color="red">$errorString</font>
#end
<br/>
    <br/>
                                                                                
    <table class="details">
      <tr>
        <th>UID:</th>
        <td><input type=text name=uid value="$admin_uid"></td>
      </tr>
      <tr>
        <th>Name:</th>
        <td><input size=35 type=text name=name value="$admin_name"></td>
      </tr>
      <tr>
        <th>Email:</th>
        <td><input size=35 type=text name=email value="$admin_email"></td>
      </tr>
      <tr>
        <th>Password:</th>
        <td><input type="password" size="40" name="__pwd" value="$admin_pwd" autocomplete="off"/></td>
      </tr>
      <tr>
        <th>Password (Again):</th>
                                                                              
        <td><input type="password" size="40" name="__admin_password_again" value="$admin_pwd_again" autocomplete="off"/></td>
<input type="hidden" name="cert_request" value=""/>
<input type="hidden" name="display" value=$displayStr />
<input type="hidden" name="profileId" value="caAdminCert" />
<input type="hidden" name="cert_request_type" value="crmf" />
<input type="hidden" name="import" value=$import />
<input type="hidden" name="uid" value="admin" />
<input type="hidden" name="securitydomain" value="$securityDomain" />
<input type="hidden" name="subject" value="cn=x" />
      </tr>
      <tr>
        <th>Key Type:</th>
        <td><select name="keytype"><option value="rsa">RSA</option><option value="ecc">ECC</option></select></td>
      </tr>
    </table>
                                                                                     <div align="right">
      <hr />
    </div>