41a086dd11382074f51188f89c925e5a39810a1e
bernd Neue Zertifikatsverwaltung

bernd authored 14 years ago

1) <?php
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

2) /*
3) This file belongs to the Webinterface of schokokeks.org Hosting
4) 
Bernd Wurst Copyright year update

Bernd Wurst authored 6 years ago

5) Written 2008-2018 by schokokeks.org Hosting, namely
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

6)   Bernd Wurst <bernd@schokokeks.org>
7)   Hanno Böck <hanno@schokokeks.org>
8) 
9) To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty.
10) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

11) You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

12) http://creativecommons.org/publicdomain/zero/1.0/
13) 
14) Nevertheless, in case you use a significant part of this code, we ask (but not require, see the license) that you keep the authors' names in place and return your changes to the public. We would be especially happy if you tell us what you're going to do with this code.
15) */
bernd Neue Zertifikatsverwaltung

bernd authored 14 years ago

16) 
17) require_once('inc/base.php');
bernd CSR-Erstellung

bernd authored 14 years ago

18) require_once('inc/security.php');
bernd Neue Zertifikatsverwaltung

bernd authored 14 years ago

19) 
20) define("CERT_OK", 0);
21) define("CERT_INVALID", 1);
22) define("CERT_NOCHAIN", 2);
23) 
24) function user_certs()
25) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

26)     $uid = (int) $_SESSION['userinfo']['uid'];
27)     $result = db_query("SELECT id, valid_from, valid_until, subject, cn FROM vhosts.certs WHERE uid=? ORDER BY cn", array($uid));
28)     $ret = array();
29)     while ($i = $result->fetch()) {
30)         $ret[] = $i;
31)     }
32)     #DEBUG($ret);
33)     return $ret;
bernd Neue Zertifikatsverwaltung

bernd authored 14 years ago

34) }
35) 
bernd CSR-Erstellung

bernd authored 14 years ago

36) function user_csr()
37) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

38)     $uid = (int) $_SESSION['userinfo']['uid'];
39)     $result = db_query("SELECT id, created, hostname, bits FROM vhosts.csr WHERE uid=? ORDER BY hostname", array($uid));
40)     $ret = array();
41)     while ($i = $result->fetch()) {
42)         $ret[] = $i;
43)     }
44)     #DEBUG($ret);
45)     return $ret;
bernd CSR-Erstellung

bernd authored 14 years ago

46) }
bernd Neue Zertifikatsverwaltung

bernd authored 14 years ago

47) 
Bernd Wurst Interface für Zertifikate i...

Bernd Wurst authored 7 years ago

48) function user_has_manual_certs()
49) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

50)     foreach (user_certs() as $c) {
51)         if (!cert_is_letsencrypt($c['id'])) {
52)             return true;
53)         }
54)     }
55)     foreach (user_csr() as $c) {
56)         return true;
Bernd Wurst Interface für Zertifikate i...

Bernd Wurst authored 7 years ago

57)     }
58) }
59) 
60) 
bernd Neue Zertifikatsverwaltung

bernd authored 14 years ago

61) function cert_details($id)
62) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

63)     $id = (int) $id;
64)     $uid = (int) $_SESSION['userinfo']['uid'];
Hanno remove whitespace in empty...

Hanno authored 5 years ago

65) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

66)     $result = db_query("SELECT id, lastchange, valid_from, valid_until, subject, cn, chain, cert, `key` FROM vhosts.certs WHERE uid=:uid AND id=:id", array(":uid" => $uid, ":id" => $id));
67)     if ($result->rowCount() != 1) {
68)         system_failure("Ungültiges Zertifikat #{$id}");
69)     }
70)     return $result->fetch();
bernd Neue Zertifikatsverwaltung

bernd authored 14 years ago

71) }
72) 
Bernd Wurst Status der letsencrypt-Opti...

Bernd Wurst authored 8 years ago

73) function cert_is_letsencrypt($id)
74) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

75)     $details = cert_details($id);
76)     #DEBUG($details);
77)     if (strpos($details['subject'], "Let's Encrypt autogenerated") > 0) {
78)         return true;
79)     }
80)     return false;
Bernd Wurst Status der letsencrypt-Opti...

Bernd Wurst authored 8 years ago

81) }
82) 
bernd Neue Zertifikatsverwaltung

bernd authored 14 years ago

83) 
bernd CSR-Erstellung

bernd authored 14 years ago

84) function csr_details($id)
85) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

86)     $id = (int) $id;
87)     $uid = (int) $_SESSION['userinfo']['uid'];
Hanno remove whitespace in empty...

Hanno authored 5 years ago

88) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

89)     $result = db_query("SELECT id, created, hostname, bits, `replace`, csr, `key` FROM vhosts.csr WHERE uid=:uid AND id=:id", array(":uid" => $uid, ":id" => $id));
90)     if ($result->rowCount() != 1) {
91)         system_failure("Ungültiger CSR");
92)     }
93)     return $result->fetch();
bernd CSR-Erstellung

bernd authored 14 years ago

94) }
95) 
96) 
bernd Neue Zertifikatsverwaltung

bernd authored 14 years ago

97) function get_available_CAs()
98) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

99)     $path = '/etc/apache2/certs/cabundle/';
100)     $ret = glob($path.'*.pem');
101)     if (! $ret) {
102)         system_failure("Konnte die CA-Zertifikate nicht laden");
103)     }
104)     DEBUG($ret);
105)     return $ret;
bernd Neue Zertifikatsverwaltung

bernd authored 14 years ago

106) }
107) 
108) 
bernd Cert-Chain erkennen und ben...

bernd authored 13 years ago

109) function get_chain($cert)
110) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

111)     $certdata = openssl_x509_parse($cert, true);
112)     if ($certdata === false) {
113)         system_failure("Das Zertifikat konnte nicht gelesen werden");
114)     }
115)     if (! isset($certdata['issuer']['CN'])) {
116)         return null;
117)     }
118)     $result = db_query("SELECT id FROM vhosts.certchain WHERE cn=?", array($certdata['issuer']['CN']));
119)     if ($result->rowCount() > 0) {
120)         $c = $result->fetch();
121)         //$chainfile = '/etc/apache2/certs/chains/'.$c['id'].'.pem';
122)         DEBUG("identified fitting certificate chain #".$c['id']);
123)         return $c['id'];
124)     }
bernd Cert-Chain erkennen und ben...

bernd authored 13 years ago

125) }
126) 
127) 
bernd Neue Zertifikatsverwaltung

bernd authored 14 years ago

128) function validate_certificate($cert, $key)
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

129) {
130)     // Lade private key
131)     $seckey = openssl_get_privatekey($key);
132)     if ($seckey === false) {
133)         system_failure("Der private Schlüssel konnte (ohne Passwort) nicht gelesen werden.");
134)     }
135)     // Lade public key
136)     $pubkey = openssl_get_publickey($cert);
137)     if ($pubkey === false) {
138)         system_failure("In dem eingetragenen Zertifikat wurde kein öffentlicher Schlüssel gefunden.");
139)     }
140)     // Parse Details über den pubkey
Hanno Böck deutlich striktere Checks b...

Hanno Böck authored 2 years ago

141)     $pubkeyinfo = openssl_pkey_get_details($pubkey);
142)     DEBUG($pubkeyinfo);
143)     if ($pubkeyinfo === false) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

144)         system_failure("Der öffentliche Schlüssel des Zertifikats konnte nicht gelesen werden");
145)     }
146) 
147)     // Apache unterstützt nur Schlüssel vom Typ RSA oder DSA
Hanno Böck deutlich striktere Checks b...

Hanno Böck authored 2 years ago

148)     if ($pubkeyinfo['type'] !== OPENSSL_KEYTYPE_RSA) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

149)         system_failure("Dieser Schlüssel nutzt einen nicht unterstützten Algorithmus.");
150)     }
Hanno remove whitespace in empty...

Hanno authored 5 years ago

151) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

152)     // Bei ECC-Keys treten kürzere Schlüssellängen auf, die können wir aktuell aber sowieso nicht unterstützen
Hanno Böck deutlich striktere Checks b...

Hanno Böck authored 2 years ago

153)     // Wir blockieren zu kurze und zu lange Schlüssel hart, da Apache sonst nicht startet
154)     if ($pubkeyinfo['bits'] < 2048) {
155)         system_failure("Schlüssellänge ist zu kurz");
156)     }
157)     if ($pubkeyinfo['bits'] > 4096) {
158)         system_failure("Schlüssellänge ist zu lang");
159)     }
160) 
161)     $x509info = openssl_x509_parse($cert);
162)     if ($x509info === false) {
163)         system_failure("Zertifikat konnte nicht verarbeitet werden");
164)     }
165)     if (!in_array($x509info['signatureTypeSN'], array("RSA-SHA256", "RSA-SHA385", "RSA-SHA512"))) {
166)         system_failure("Nicht unterstützer Signatur-Hashalgorithmus!");
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

167)     }
168) 
169)     // Prüfe ob Key und Zertifikat zusammen passen
170)     if (openssl_x509_check_private_key($cert, $key) !== true) {
171)         DEBUG("Zertifikat und Key passen nicht zusammen: ".openssl_x509_check_private_key($cert, $key));
172)         return CERT_INVALID;
173)     }
174) 
Hanno Böck deutlich striktere Checks b...

Hanno Böck authored 2 years ago

175)     // Check von openssl_x509_check_private_key() ist leider nicht ausreichend
176)     $testdata = base64_encode(random_bytes(32));
177)     if (openssl_sign($testdata, $signature, $seckey) !== true) {
178)         system_failure("Kann keine Testsignatur erstellen, Key ungültig!");
179)     }
180)     if (openssl_verify($testdata, $signature, $pubkey) !== 1) {
181)         system_failure("Testsignatur ungültig, Key vermutlich fehlerhaft!");
182)     }
183) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

184)     $cacerts = array('/etc/ssl/certs');
185)     $chain = (int) get_chain($cert);
186)     if ($chain) {
187)         $result = db_query("SELECT content FROM vhosts.certchain WHERE id=?", array($chain));
188)         $tmp = $result->fetch();
189)         $chaincert = $tmp['content'];
190)         $chainfile = tempnam(sys_get_temp_dir(), 'webinterface');
191)         $f = fopen($chainfile, "w");
192)         fwrite($f, $chaincert);
193)         fclose($f);
194)         $cacerts[] = $chainfile;
195)     }
196) 
197)     $valid = openssl_x509_checkpurpose($cert, X509_PURPOSE_SSL_SERVER, $cacerts);
198)     if ($chain) {
199)         unlink($chainfile);
200)     }
201)     if ($valid !== true) {
202)         DEBUG('certificate was not validated as a server certificate with the available chain');
203)         return CERT_NOCHAIN;
204)     }
205) 
206)     return CERT_OK;
bernd Neue Zertifikatsverwaltung

bernd authored 14 years ago

207) }
208) 
209) 
210) function parse_cert_details($cert)
211) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

212)     $certdata = openssl_x509_parse($cert, true);
213)     /*
bernd Neue Zertifikatsverwaltung

bernd authored 14 years ago

214) name => /CN=*.bwurst.org
215) validFrom_time_t => 1204118790
216) validTo_time_t => 1267190790
217) 
218) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

219)     */
220)     DEBUG($certdata);
221)     DEBUG("SAN: ".$certdata['extensions']['subjectAltName']);
222)     //return array('subject' => $certdata['name'], 'cn' => $certdata['subject']['CN'], 'valid_from' => date('Y-m-d', $certdata['validFrom_time_t']), 'valid_until' => date('Y-m-d', $certdata['validTo_time_t']));
223)     $issuer = $certdata['issuer']['CN'];
224)     if (isset($certdata['issuer']['O'])) {
225)         $issuer = $certdata['issuer']['O'];
226)     }
227)     $san = array();
228)     $raw_san = explode(', ', $certdata['extensions']['subjectAltName']);
229)     foreach ($raw_san as $name) {
230)         if (! substr($name, 0, 4) == 'DNS:') {
231)             warning('Unparsable SAN: '.$name);
232)             continue;
233)         }
234)         $san[] = str_replace('DNS:', '', $name);
Bernd Wurst Verarbeite und Speichere SA...

Bernd Wurst authored 7 years ago

235)     }
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

236)     $san = implode("\n", $san);
237)     DEBUG("SAN: <pre>".$san."</pre>");
238)     return array('subject' => $certdata['subject']['CN'].' / '.$issuer, 'cn' => $certdata['subject']['CN'], 'valid_from' => date('Y-m-d', $certdata['validFrom_time_t']), 'valid_until' => date('Y-m-d', $certdata['validTo_time_t']), 'issuer' => $certdata['issuer']['CN'], 'san' => $san);
bernd Neue Zertifikatsverwaltung

bernd authored 14 years ago

239) }
240) 
241) 
242) function save_cert($info, $cert, $key)
243) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

244)     openssl_pkey_export($key, $key);
245)     openssl_x509_export($cert, $cert);
246)     $uid = (int) $_SESSION['userinfo']['uid'];
247) 
248)     db_query(
Hanno Update codingstyle accordin...

Hanno authored 5 years ago

249)         "INSERT INTO vhosts.certs (uid, subject, cn, san, valid_from, valid_until, chain, cert, `key`) VALUES (:uid, :subject, :cn, :san, :valid_from, :valid_until, :chain, :cert, :key)",
Bernd Wurst Umstellung von filter_input...

Bernd Wurst authored 4 years ago

250)         array(":uid" => $uid, ":subject" => filter_input_oneline($info['subject']), ":cn" => filter_input_oneline($info['cn']), ":san" => $info['san'], ":valid_from" => $info['valid_from'],
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

251)               ":valid_until" => $info['valid_until'], ":chain" => get_chain($cert), ":cert" => $cert, ":key" => $key)
Hanno Fix codingstyle

Hanno authored 4 years ago

252)     );
bernd Neue Zertifikatsverwaltung

bernd authored 14 years ago

253) }
254) 
bernd Cert-Refresh

bernd authored 14 years ago

255) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

256) function refresh_cert($id, $info, $cert, $key = null)
bernd Cert-Refresh

bernd authored 14 years ago

257) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

258)     openssl_x509_export($cert, $cert);
259)     $chain = get_chain($cert);
bernd Bugfix: Beim Eintragen eine...

bernd authored 13 years ago

260) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

261)     $id = (int) $id;
262)     $oldcert = cert_details($id);
Bernd Wurst Umstellung von filter_input...

Bernd Wurst authored 4 years ago

263)     $args = array(":subject" => filter_input_oneline($info['subject']),
264)                 ":cn" => filter_input_oneline($info['cn']),
Bernd Wurst Fix SAN for refreshed certs

Bernd Wurst authored 5 years ago

265)                 ":san" => $info['san'],
Bernd Wurst Einige Statements auf Prepa...

Bernd Wurst authored 10 years ago

266)                 ":cert" => $cert,
267)                 ":valid_from" => $info['valid_from'],
268)                 ":valid_until" => $info['valid_until'],
269)                 ":chain" => get_chain($cert),
270)                 ":id" => $id);
271) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

272)     $keyop = '';
273)     if ($key) {
274)         openssl_pkey_export($key, $key);
275)         $keyop = ", `key`=:key";
276)         $args[":key"] = $key;
277)     }
278)     db_query("UPDATE vhosts.certs SET subject=:subject, cn=:cn, san=:san, cert=:cert{$keyop}, valid_from=:valid_from, valid_until=:valid_until, chain=:chain WHERE id=:id", $args);
bernd Cert-Refresh

bernd authored 14 years ago

279) }
280) 
281) 
bernd Neue Zertifikatsverwaltung

bernd authored 14 years ago

282) function delete_cert($id)
283) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

284)     $uid = (int) $_SESSION['userinfo']['uid'];
285)     $id = (int) $id;
Hanno remove whitespace in empty...

Hanno authored 5 years ago

286) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

287)     db_query("DELETE FROM vhosts.certs WHERE uid=? AND id=?", array($uid, $id));
bernd Neue Zertifikatsverwaltung

bernd authored 14 years ago

288) }
289) 
bernd CSR-Erstellung

bernd authored 14 years ago

290) function delete_csr($id)
291) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

292)     $uid = (int) $_SESSION['userinfo']['uid'];
293)     $id = (int) $id;
Hanno remove whitespace in empty...

Hanno authored 5 years ago

294) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

295)     db_query("DELETE FROM vhosts.csr WHERE uid=? AND id=?", array($uid, $id));
bernd CSR-Erstellung

bernd authored 14 years ago

296) }
297) 
298) 
Bernd Wurst * Ermögliche SAN bei CSRs *...

Bernd Wurst authored 8 years ago

299) function split_cn($cn)
300) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

301)     $domains = array();
302)     if (strstr($cn, ',') or strstr($cn, "\n")) {
303)         $domains = preg_split("/[, \n]+/", $cn);
304)         DEBUG("Domains:");
305)         DEBUG($domains);
306)     } else {
307)         $domains[] = $cn;
308)     }
309)     for ($i=0;$i!=count($domains);$i++) {
310)         $domains[$i] = filter_input_hostname($domains[$i], true);
311)     }
312)     return $domains;
Bernd Wurst * Ermögliche SAN bei CSRs *...

Bernd Wurst authored 8 years ago

313) }
314) 
bernd CSR-Erstellung

bernd authored 14 years ago

315) function create_csr($cn, $bits)
316) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

317)     $domains = split_cn($cn);
318)     $tmp = array();
319)     foreach ($domains as $dom) {
320)         $tmp[] = 'DNS:'.$dom;
321)     }
322)     $SAN = "[ v3_req ]\nsubjectAltName = ".implode(', ', $tmp);
323)     DEBUG($SAN);
324)     $cn = $domains[0];
325)     $bits = (int) $bits;
326)     if ($bits == 0) {
327)         $bits = 4096;
328)     }
329) 
330)     $keyfile = tempnam(ini_get('upload_tmp_dir'), 'key');
331)     $csrfile = tempnam(ini_get('upload_tmp_dir'), 'csr');
332)     $config = tempnam(ini_get('upload_tmp_dir'), 'config');
333) 
334)     DEBUG("key: ".$keyfile." / csr: ".$csrfile." / config: ".$config);
335) 
336)     $c = fopen($config, "w");
337)     fwrite($c, "[req]
bernd CSR-Erstellung

bernd authored 14 years ago

338) default_bits = {$bits}
339) default_keyfile = {$keyfile}
340) encrypt_key = no
341) distinguished_name      = req_distinguished_name
Bernd Wurst * Ermögliche SAN bei CSRs *...

Bernd Wurst authored 8 years ago

342) req_extensions = v3_req
bernd CSR-Erstellung

bernd authored 14 years ago

343) 
344) [ req_distinguished_name ]
345) countryName                     = Country Name (2 letter code)
Bernd Wurst Leere Vorgaben für CSR-Details

Bernd Wurst authored 10 years ago

346) countryName_default             = 
bernd CSR-Erstellung

bernd authored 14 years ago

347) stateOrProvinceName             = State or Province Name (full name)
Bernd Wurst Leere Vorgaben für CSR-Details

Bernd Wurst authored 10 years ago

348) stateOrProvinceName_default     = 
bernd CSR-Erstellung

bernd authored 14 years ago

349) localityName                    = Locality Name (eg, city)
Bernd Wurst Leere Vorgaben für CSR-Details

Bernd Wurst authored 10 years ago

350) localityName_default            = 
bernd CSR-Erstellung

bernd authored 14 years ago

351) 0.organizationName              = Organization Name (eg, company)
Bernd Wurst Leere Vorgaben für CSR-Details

Bernd Wurst authored 10 years ago

352) 0.organizationName_default      = 
bernd CSR-Erstellung

bernd authored 14 years ago

353) 
354) commonName = Common Name
355) commonName_default = {$cn}
Bernd Wurst * Ermögliche SAN bei CSRs *...

Bernd Wurst authored 8 years ago

356) {$SAN}
bernd CSR-Erstellung

bernd authored 14 years ago

357) ");
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

358)     fclose($c);
359) 
360)     $output = '';
361)     $cmdline = "openssl req -sha256 -new -batch -config {$config} -out {$csrfile}";
362)     $retval = 0;
363)     exec($cmdline, $output, $retval);
364)     DEBUG($output);
365)     DEBUG($retval);
366)     if ($retval != 0) {
367)         system_failure("Die Erzeugung des CSR ist fehlgeschlagen. Ausgabe des OpenSSL-Befehls: ".print_r($output, true));
368)     }
Hanno remove whitespace in empty...

Hanno authored 5 years ago

369) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

370)     $csr = file_get_contents($csrfile);
371)     $key = file_get_contents($keyfile);
bernd CSR-Erstellung

bernd authored 14 years ago

372) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

373)     unlink($csrfile);
374)     unlink($keyfile);
375)     unlink($config);
bernd CSR-Erstellung

bernd authored 14 years ago

376) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

377)     return array($csr, $key);
bernd CSR-Erstellung

bernd authored 14 years ago

378) }
379) 
380) 
381) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

382) function save_csr($cn, $bits, $replace=null)
bernd CSR-Erstellung

bernd authored 14 years ago

383) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

384)     if (! $cn) {
385)         system_failure("Sie müssen einen Domainname eingeben!");
386)     }
387)     $domains = split_cn($cn);
388)     $cn = $domains[0];
389)     $san = implode("\n", $domains);
390)     $csr = null;
391)     $key = null;
392)     list($csr, $key) = create_csr(implode(',', $domains), $bits);
Hanno remove whitespace in empty...

Hanno authored 5 years ago

393) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

394)     $uid = (int) $_SESSION['userinfo']['uid'];
395)     db_query(
Hanno Update codingstyle accordin...

Hanno authored 5 years ago

396)         "INSERT INTO vhosts.csr (uid, hostname, san, bits, `replace`, csr, `key`) VALUES (:uid, :cn, :san, :bits, :replace, :csr, :key)",
397)         array(":uid" => $uid, ":cn" => $cn, ":san" => $san, ":bits" => $bits,
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

398)                  ":replace" => $replace, ":csr" => $csr, ":key" => $key)
Hanno Fix codingstyle

Hanno authored 4 years ago

399)     );
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

400)     $id = db_insert_id();
401)     return $id;