<%args> $identifier => undef

<% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_API_CERT_FULL_INFO_TITLE') %>

<% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_API_CERT_FULL_INFO_DESCRIPTION') %>

% if ($status eq 'REVOKED') {

<% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_API_CERT_INFO_REVOKED_DESC') %>

% } % elsif ($status eq 'SUSPENDED') {

<% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_API_CERT_INFO_SUSPENDED_DESC') %>

% } % elsif ($status eq 'CRL_ISSUANCE_PENDING') {

<% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_API_CERT_INFO_CRL_ISSUANCE_PENDING_DESC') %>

% } % foreach my $san (@subject_alt_names) { % } % if ($subject_key_identifier) { % } % } % if (defined $keyusage and length $keyusage) { % } % if (defined $extended_keyusage and length $extended_keyusage) { % } % if (scalar @cdps) { % for (my $i = 1; $i < scalar @cdps; $i++) { % } % } % if (scalar @aia) { % for (my $i = 1; $i < scalar @aia; $i++) { % } % } % foreach my $notice (@user_notice) { % } % foreach my $policy (@policies) { % } % if ($algo eq 'RSA') { % } % if ($pubkey) { % }
<% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_TABLE_HEAD_NAME') %> <% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_TABLE_HEAD_VALUE') %>
<% i18nGettext('I18N_OPENXPKI_CERT_SUBJECT') %> <% delete $params->{SUBJECT} %>
<% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_CSR_CERT_SUBJECT_ALT_NAME') %> <% $san %>
<% i18nGettext('I18N_OPENXPKI_CERT_SERIAL') %> <% $serial %>
<% i18nGettext('I18N_OPENXPKI_CERT_FINGERPRINT') %> <% delete $params->{FINGERPRINT} %>
<% i18nGettext('I18N_OPENXPKI_CERT_SUBJECT_KEY_IDENTIFIER') %> <% $subject_key_identifier %>
<% i18nGettext('I18N_OPENXPKI_CERT_NOTBEFORE') %> <% join " ", split "T", delete $params->{NOTBEFORE} %> UTC % if ($not_yet_valid) { (<% i18nGettext('I18N_OPENXPKI_CERT_NOT_YET_VALID') %>) % }
<% i18nGettext('I18N_OPENXPKI_CERT_NOTAFTER') %> <% join " ", split "T", delete $params->{NOTAFTER} %> UTC % if ($expired) { (<% i18nGettext('I18N_OPENXPKI_CERT_EXPIRED') %>)
<% i18nGettext('I18N_OPENXPKI_CERT_ISSUER') %> % if (! $issuer_identifier) { % # issuer identifier is not defined due to: % if (exists $params->{IS_CA} and $params->{IS_CA}) { % # 1. self-signed CA certificate, show subject in the 'issuer' field <% $subject %> % } else { % # 2. any other reason, show 'information is not available' message <% i18nGettext('I18N_OPENXPKI_NOT_AVAILABLE') %> % } % } else { % # issuer identifier is defined <& /lib/html/a.mhtml, target => 'cert_info.html', label => $issuer, params => [["identifier", $issuer_identifier]] &> % }
<% i18nGettext('I18N_OPENXPKI_CERT_KEYUSAGE') %> <% $keyusage %>
<% i18nGettext('I18N_OPENXPKI_CERT_EXTENDED_KEYUSAGE') %> <% $extended_keyusage %>
<% i18nGettext('I18N_OPENXPKI_CERT_CDPS') %> <% $cdps[0] %>
<% $cdps[$i] %>
<% i18nGettext('I18N_OPENXPKI_CERT_AIA') %> <% $aia[0] %>
<% $aia[$i] %>
<% i18nGettext('I18N_OPENXPKI_CERT_USER_NOTICE') %> <% $notice %>
<% i18nGettext('I18N_OPENXPKI_CERT_POLICY') %> <% $policy %>
<% i18nGettext('I18N_OPENXPKI_CSR_SERIAL') %> <% $csr_serial %>
<% i18nGettext('I18N_OPENXPKI_CERT_IS_CA') %> % if (delete $params->{IS_CA}) { <% i18nGettext('I18N_OPENXPKI_YES') %> % } else { <% i18nGettext('I18N_OPENXPKI_NO') %> % }
<% i18nGettext('I18N_OPENXPKI_CERT_KEY_ALGORITHM') %> <% $algo %>
<% i18nGettext('I18N_OPENXPKI_CERT_KEY_SIZE') %> <% delete $params->{KEYSIZE} %>
<% i18nGettext('I18N_OPENXPKI_CERT_KEY_EXPONENT') %> <% delete $params->{EXPONENT} %>
<% i18nGettext('I18N_OPENXPKI_CERT_PUBLIC_KEY') %>
<% $pubkey | n %>
<%init> ## first we need the issuer identifier and the CSR serial my $msg = $context->{client}->send_receive_command_msg ( "search_cert", {'IDENTIFIER' => $identifier}); my $issuer_identifier = $msg->{PARAMS}->[0]->{ISSUER_IDENTIFIER}; my $csr_serial = $msg->{PARAMS}->[0]->{CSR_SERIAL}; $csr_serial = i18nGettext('I18N_OPENXPKI_NOT_AVAILABLE') if (not defined $csr_serial or not length $csr_serial); ## second we download the certificate itself $msg = $context->{client}->send_receive_command_msg ( "get_cert", {'IDENTIFIER' => $identifier}); my $params = $msg->{PARAMS}->{BODY}; my $status = $msg->{PARAMS}->{STATUS}; my $keyusage; my $extended_keyusage; if (ref $params->{OPENSSL_EXTENSIONS}->{'X509v3 Key Usage'} eq 'ARRAY') { $keyusage = join q{,}, @{ $params->{OPENSSL_EXTENSIONS}->{'X509v3 Key Usage'} }; } if (ref $params->{OPENSSL_EXTENSIONS}->{'X509v3 Extended Key Usage'} eq 'ARRAY') { $extended_keyusage = join q{,}, @{ $params->{OPENSSL_EXTENSIONS}->{'X509v3 Extended Key Usage'} }; } my @subject_alt_names = (); if (ref $params->{OPENSSL_EXTENSIONS}->{'X509v3 Subject Alternative Name'} eq 'ARRAY') { @subject_alt_names = split q{, }, $params->{OPENSSL_EXTENSIONS}->{'X509v3 Subject Alternative Name'}->[0]; foreach my $san (@subject_alt_names) { $san =~ s/:/: /; } } my $subject_key_identifier; if (ref $params->{OPENSSL_EXTENSIONS}->{'X509v3 Subject Key Identifier'} eq 'ARRAY') { $subject_key_identifier = $params->{OPENSSL_EXTENSIONS}->{'X509v3 Subject Key Identifier'}->[0]; } my @cdps = (); if (ref $params->{OPENSSL_EXTENSIONS}->{'X509v3 CRL Distribution Points'} eq 'ARRAY') { @cdps = @{ $params->{OPENSSL_EXTENSIONS}->{'X509v3 CRL Distribution Points'} }; foreach my $cdp (@cdps) { $cdp =~ s{\A URI:}{}xms; } } my @aia = (); if (ref $params->{OPENSSL_EXTENSIONS}->{'Authority Information Access'} eq 'ARRAY') { @aia = @{ $params->{OPENSSL_EXTENSIONS}->{'Authority Information Access'} }; foreach my $aia (@aia) { $aia =~ s{URI:}{}xms; } } my @policies = (); if (ref $params->{OPENSSL_EXTENSIONS}->{'X509v3 Certificate Policies'} eq 'ARRAY') { @policies = @{ $params->{OPENSSL_EXTENSIONS}->{'X509v3 Certificate Policies'} }; foreach my $policy (@policies) { $policy =~ s/Policy: //; } } my @user_notice = (); if (ref $params->{OPENSSL_EXTENSIONS}->{'User Notice'} eq 'ARRAY') { @user_notice = @{ $params->{OPENSSL_EXTENSIONS}->{'User Notice'} }; foreach my $notice (@user_notice) { $notice =~ s{\A Explicit\ Text:\ }{}xms; } } my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = gmtime(time); $year += 1900; $mon++; my $now = sprintf("%04d-%02d-%02dT%02d:%02d%02d", $year, $mon, $mday, $hour, $min, $sec); my $not_yet_valid; my $expired; if ($now lt $params->{NOTBEFORE}) { $not_yet_valid = 1; } if ($now gt $params->{NOTAFTER}) { $expired = 1; } my $serial = $params->{SERIAL}; $serial .= ' (0x' . $params->{SERIAL_HEX} . ')'; my $subject = $params->{SUBJECT}; $subject =~ s/,/, /g; my $issuer = $params->{ISSUER}; $issuer =~ s/,/, /g; my $algo = $params->{PUBKEY_ALGORITHM}; if ($algo eq 'rsaEncryption') { $algo = 'RSA'; } if ($algo eq 'dsaEncryption') { $algo = 'DSA'; } my $pubkey = $params->{PUBKEY}; $pubkey =~ s/\n\s+/\n/g; $pubkey =~ s/\n//g; <%once> use Data::Dumper;