<%args>
  $identifier => undef
</%args>
<h1>
  <% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_API_CA_CERT_INFO_TITLE') %>
</h1>
<p>
  <% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_API_CA_CERT_INFO_DESCRIPTION') %>
</p>
<table>
  <tr>
    <th><% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_TABLE_HEAD_NAME') %></th>
    <th><% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_TABLE_HEAD_VALUE') %></th>
  </tr>
  <tr>
    <td><% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_CERT_INFO') %></td>
    <td>
      <& /lib/html/a.mhtml,
         target => 'cert_full_info.html',
         label  => i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_FULL_CERT_INFO_LINK'),
         params => [["identifier", $identifier]] &>
    </td>
  </tr>
  <tr>
    <td><% i18nGettext('I18N_OPENXPKI_CERT_SUBJECT') %></td>
    <td><% $subject %></td>
  </tr>
  <tr>
    <td><% i18nGettext('I18N_OPENXPKI_CERT_FINGERPRINT') %></td>
    <td><% $fingerprint %></td>
  </tr>
  <tr>
    <td><% i18nGettext('I18N_OPENXPKI_CERT_NOTBEFORE') %></td>
    <td><% join " ", split "T", $notbefore %> UTC</td>
  </tr>
  <tr>
    <td><% i18nGettext('I18N_OPENXPKI_CERT_NOTAFTER') %></td>
    <td><% join " ", split "T", $notafter %> UTC</td>
  </tr>
  <tr>
    <td><% i18nGettext('I18N_OPENXPKI_CERT_ISSUER') %></td>
    <td><% $issuer %></td>
  </tr>
  <tr>
    <td><% i18nGettext('I18N_OPENXPKI_CERT_DOWNLOAD_MOZILLA') %></td>
    <td>
      <& /lib/html/a.mhtml,
         target => '../../binary/get_certificate.html',
         label  => i18nGettext('I18N_OPENXPKI_CERT_DOWNLOAD'),
         params => [["identifier",   $identifier],
                    ["content_type", "X509_CA_CERT"],
                    ["format",       "PEM"]] &>
    </td>
  </tr>
  <tr>
    <td><% i18nGettext('I18N_OPENXPKI_CERT_DOWNLOAD_INTERNET_EXPLORER') %></td>
    <td>
      <& /lib/html/a.mhtml,
         target => '../../binary/get_certificate.crt',
         label  => i18nGettext('I18N_OPENXPKI_CERT_DOWNLOAD'),
         params => [["identifier",   $identifier],
                    ["content_type", "IE_CA"],
                    ["format",       "PEM"]] &>
    </td>
  </tr>
  <tr>
    <td><% i18nGettext('I18N_OPENXPKI_CERT_DOWNLOAD_PEM') %></td>
    <td>
      <& /lib/html/a.mhtml,
         target => '../../binary/get_certificate.html',
         label  => i18nGettext('I18N_OPENXPKI_CERT_DOWNLOAD'),
         params => [["identifier",   $identifier],
                    ["content_type", "PLAIN"],
                    ["format",       "PEM"]] &>
    </td>
  </tr>
  <tr>
    <td><% i18nGettext('I18N_OPENXPKI_CERT_DOWNLOAD_TXT') %></td>
    <td>
      <& /lib/html/a.mhtml,
         target => '../../binary/get_certificate.html',
         label  => i18nGettext('I18N_OPENXPKI_CERT_DOWNLOAD'),
         params => [["identifier",   $identifier],
                    ["content_type", "PLAIN"],
                    ["format",       "TXT"]] &>
    </td>
  </tr>
</table>
<%init>
  my $msg  = $context->{client}->send_receive_command_msg (
                  "get_ca_cert",
                  {'IDENTIFIER' => $identifier});
  ## print Dumper($msg)."\n";

  my $params      = $msg->{PARAMS}->{BODY};
  my $subject     = $params->{SUBJECT};
  my $notbefore   = $params->{NOTBEFORE};
  my $notafter    = $params->{NOTAFTER};
  my $issuer      = $params->{ISSUER};
  my $fingerprint = $params->{FINGERPRINT};
</%init>
