3 $content_type =
> "PLAIN"
8 ## first we have to determine the content
-type
10 switch ($content_type
)
12 case "X509_CA_CERT" {$content_type
= "application/x-x509-ca-cert"; $attachment
= 0; }
13 case "X509_USER_CERT" {$content_type
= "application/x-x509-user-cert"; $attachment
= 0; }
14 case "X509_EMAIL_CERT" {$content_type
= "application/x-x509-email-cert"; $attachment
= 0; }
15 case "IE_CA" {$content_type
= "application/x-x509-ca-cert"}
16 case "IE_USER" {$content_type
= "application/x-x509-user-cert"}
17 case "PLAIN" {$content_type
= "text/plain"; $attachment
= 0;}
18 case "DOWNLOAD" {$content_type
= "application/octet-string"}
20 print
"<h1>".i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_GET_CERT_WRONG_CONTENT_TYPE_TITLE')."</h1>\n";
22 print
i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_GET_CERT_WRONG_CONTENT_TYPE_DESC',
23 '__CONTENT_TYPE__' => $content_type
)."\n";
29 ## second we have to check the format
34 case "PKCS7" {$
native = "PKCS7"; $extension
= 'p7'; }
35 case "TXT" {$
native = "TXT"; $extension
= 'txt'; }
36 case "DER" {$
native = "DER"; $extension
= 'der'; }
37 case "PEM" {$
native = "PEM"; $extension
= 'pem'; $attachment
= 1; }
38 case "IE_ENROLL" {$
native = "PEM"; $extension
= 'pem'; } # ???
40 print
"<h1>".i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_GET_CERT_WRONG_FORMAT_TITLE')."</h1>\n";
42 print
i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_GET_CERT_WRONG_FORMAT_DESC',
43 '__FORMAT__' => $format
)."\n";
49 if ($format eq
'PEM' && $content_type ne
'DOWNLOAD') {
50 # Mozilla certificate installation has to be sent inline
53 my $filename
= $m
->comp('/lib/filename_for_cert.mhtml',
54 'identifier' => $identifier
,
55 'extension' => $extension
,
58 ## now request the certificate from the server
59 my $msg
= $context
->{client
}->send_receive_command_msg (
61 {'IDENTIFIER' => $identifier
,
62 'FORMAT' => $
native});
63 my $item
= $msg
->{PARAMS
};
68 $r
->header_out('Content-Disposition' => ("attachment; filename=$filename"));
72 $r
->headers_out
->add('Content-Disposition' => ("attachment; filename=$filename"));
75 $r
->content_type ($content_type
);