<%args> $identifier => undef $content_type => "PLAIN" $format => "PEM" <%init> ## first we have to determine the content-type switch ($content_type) { case "X509_CA_CERT" {$content_type = "application/x-x509-ca-cert"} case "X509_USER_CERT" {$content_type = "application/x-x509-user-cert"} case "X509_EMAIL_CERT" {$content_type = "application/x-x509-email-cert"} case "IE_CA" {$content_type = "application/x-x509-ca-cert"} case "IE_USER" {$content_type = "application/x-x509-user-cert"} case "PLAIN" {$content_type = "text/plain"} case "DOWNLOAD" {$content_type = "application/octet-string"} else { print "

".i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_GET_CERT_WRONG_CONTENT_TYPE_TITLE')."

\n"; print "

\n"; print i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_GET_CERT_WRONG_CONTENT_TYPE_DESC', '__CONTENT_TYPE__' => $content_type)."\n"; print "

\n"; return 1; } } ## second we have to check the format my $native = ""; switch ($format) { case "PKCS7" {$native = "PKCS7"} case "TXT" {$native = "TXT"} case "DER" {$native = "DER"} case "PEM" {$native = "PEM"} case "IE_ENROLL" {$native = "PEM"} else { print "

".i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_GET_CERT_WRONG_FORMAT_TITLE')."

\n"; print "

\n"; print i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_GET_CERT_WRONG_FORMAT_DESC', '__FORMAT__' => $format)."\n"; print "

\n"; return 1; } } ## now request the certificate from the server my $msg = $context->{client}->send_receive_command_msg ( "get_cert", {'IDENTIFIER' => $identifier, 'FORMAT' => $native}); my $item = $msg->{PARAMS}; ## now send the stuff $r->content_type ($content_type); print $item; return 1; <%once> use Switch;