Handle hostnames with upper-case letters
[webmin.git] / webmin / download_cert.cgi
1 #!/usr/local/bin/perl
2 # Output the certificate in PEM or PKCS12 format
3
4 require './webmin-lib.pl';
5 &ReadParse();
6
7 &get_miniserv_config(\%miniserv);
8
9 if ($ENV{'PATH_INFO'} =~ /\.p12$/) {
10         # PKCS12 format
11         $data = &cert_pkcs12_data($miniserv{'keyfile'}, $miniserv{'certfile'});
12         $type = "application/x-pkcs12";
13         }
14 else {
15         # PEM format
16         $data = &cert_pem_data($miniserv{'certfile'} || $miniserv{'keyfile'});
17         $type = "text/plain";
18         }
19 if ($data) {
20         print "Content-type: $type\n\n";
21         print $data;
22         }
23 else {
24         &error($text{'ssl_edownload'});
25         }