1 <% include('elements/svc_Common.html',
4 #'html_foot' => $html_foot,
10 my $fields = FS::svc_cert->table_info->{'fields'};
11 my %labels = map { $_ => ( ref($fields->{$_})
12 ? $fields->{$_}{'label'}
19 { field=>'privatekey',
22 if ( $svc_cert->privatekey && $svc_cert->check_privatekey ) {
23 '<FONT COLOR="#33ff33">Verification OK</FONT>';
24 } elsif ( $svc_cert->privatekey ) {
25 '<FONT COLOR="#ff0000">Verification error</FONT>';
31 qw( common_name organization organization_unit city state country cert_contact
36 if ( $svc_cert->csr ) { #display the subject etc?
37 '<PRE><FONT STYLE="font-family:monospace">'. "\n". $svc_cert->csr.
39 } elsif ( $svc_cert->common_name ) {
40 my $svcnum = $svc_cert->svcnum;
41 qq(<A HREF="${p}misc/svc_cert-generate.html?action=generate_csr;svcnum=$svcnum">Generate</A>);
47 { 'field'=>'certificate',
50 if ( $svc_cert->certificate ) {
52 my %hash = $svc_cert->check_certificate;
54 tie my %w, 'Tie::IxHash',
55 'subject' => 'Issued to',
56 'issuer' => 'Issued by',
59 my $out = '<TABLE><TR><TD>';
61 foreach my $w ( keys %w ) {
63 $out .= include('/elements/table-grid.html'). #'<TABLE>'.
64 '<TR><TH COLSPAN=2 BGCOLOR="#cccccc" ALIGN="center">'.
67 my $col = $svc_cert->subj_col;
70 foreach my $key (keys %$col) { #( keys %$subj ) {
71 $out .= "<TR><TD>". $labels{$col->{$key}}. "</TD>".
72 "<TD>". $subj->{$key}. "</TD></TR>";
75 $out .= '</TABLE></TD><TD>';
77 $out .= '</TD></TR></TABLE>';
80 '<TR><TH ALIGN="right">Serial number</TH>'.
81 "<TD>$hash{serial}</TD></TR>".
82 '<TR><TH ALIGN="right">Valid</TH>'.
83 "<TD>$hash{notBefore} - $hash{notAfter}</TD></TR>".
86 my $svcnum = $svc_cert->svcnum;
88 if ( $hash{'selfsigned'} ) {
89 $out .= qq(<BR> <A HREF="${p}misc/svc_cert-generate.html?action=generate_selfsigned;svcnum=$svcnum">Re-generate self-signed</A>).
91 include('/elements/popup_link.html', {
92 'action' => $p."edit/svc_cert/import_certificate.html".
94 'label' => 'Import issued certificate', #link
95 'actionlabel' => 'Import issued certificate', #title
99 #'color' => '#ff0000',
104 $out .= '<PRE><FONT STYLE="font-family:monospace">'.
105 $svc_cert->certificate.
109 } elsif ( $svc_cert->csr ) {
110 my $svcnum = $svc_cert->svcnum;
111 qq(<A HREF="${p}misc/svc_cert-generate.html?action=generate_selfsigned;svcnum=$svcnum">Generate self-signed</A>);
119 my $svc_cert = shift;
120 if ( $svc_cert->cacert ) {
122 my %hash = $svc_cert->check_cacert;
124 tie my %w, 'Tie::IxHash',
125 'subject' => 'Issued to',
126 'issuer' => 'Issued by',
129 my $out = '<TABLE><TR><TD>';
131 foreach my $w ( keys %w ) {
133 $out .= include('/elements/table-grid.html'). #'<TABLE>'.
134 '<TR><TH COLSPAN=2 BGCOLOR="#cccccc" ALIGN="center">'.
135 $w{$w}. '</TH></TR>';
137 my $col = $svc_cert->subj_col;
139 my $subj = $hash{$w};
140 foreach my $key (keys %$col) { #( keys %$subj ) {
141 $out .= "<TR><TD>". $labels{$col->{$key}}. "</TD>".
142 "<TD>". $subj->{$key}. "</TD></TR>";
145 $out .= '</TABLE></TD><TD>';
147 $out .= '</TD></TR></TABLE>';
150 '<TR><TH ALIGN="right">Serial number</TH>'.
151 "<TD>$hash{serial}</TD></TR>".
152 '<TR><TH ALIGN="right">Valid</TH>'.
153 "<TD>$hash{notBefore} - $hash{notAfter}</TD></TR>".
156 $out .= '<PRE><FONT STYLE="font-family:monospace">'.
157 $svc_cert->certificate.
164 my $svcnum = $svc_cert->svcnum;
166 include('/elements/popup_link.html', {
167 'action' => $p."edit/svc_cert/import_cacert.html".
169 'label' => 'Import certificate authority chain',#link
170 'actionlabel' => 'Import certificate authority chain',#title
174 #'color' => '#ff0000',
175 }). ' (optional)'.