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',
20 value_callback=> sub {
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
34 'value_callback'=> sub {
36 if ( $svc_cert->csr ) {
40 my %hash = $svc_cert->check_csr;
42 $out .= include('/elements/table-grid.html'). #'<TABLE>'.
43 '<TR><TH COLSPAN=2 BGCOLOR="#cccccc" ALIGN="center">'.
44 'Requested by</TH></TR>';
46 my $col = $svc_cert->subj_col;
48 foreach my $key (keys %hash) {
49 $out .= "<TR><TD>". $labels{$col->{$key}}. "</TD>".
50 "<TD>". $hash{$key}. "</TD></TR>";
56 '<PRE><FONT STYLE="font-family:monospace">'. $svc_cert->csr.
61 } elsif ( $svc_cert->common_name ) {
62 my $svcnum = $svc_cert->svcnum;
63 qq(<A HREF="${p}misc/svc_cert-generate.html?action=generate_csr;svcnum=$svcnum">Generate</A>);
69 { 'field'=>'certificate',
70 'value_callback'=> sub {
72 if ( $svc_cert->certificate ) {
74 my %hash = $svc_cert->check_certificate;
76 tie my %w, 'Tie::IxHash',
77 'subject' => 'Issued to',
78 'issuer' => 'Issued by',
81 my $out = '<TABLE><TR><TD>';
83 foreach my $w ( keys %w ) {
85 $out .= include('/elements/table-grid.html'). #'<TABLE>'.
86 '<TR><TH COLSPAN=2 BGCOLOR="#cccccc" ALIGN="center">'.
89 my $col = $svc_cert->subj_col;
92 foreach my $key (keys %$col) { #( keys %$subj ) {
93 $out .= "<TR><TD>". $labels{$col->{$key}}. "</TD>".
94 "<TD>". $subj->{$key}. "</TD></TR>";
97 $out .= '</TABLE></TD><TD>';
99 $out .= '</TD></TR></TABLE>';
102 '<TR><TH ALIGN="right">Serial number</TH>'.
103 "<TD>$hash{serial}</TD></TR>".
104 '<TR><TH ALIGN="right">Valid</TH>'.
105 "<TD>$hash{notBefore} - $hash{notAfter}</TD></TR>".
108 my $svcnum = $svc_cert->svcnum;
110 if ( $hash{'selfsigned'} ) {
111 $out .= qq(<BR> <A HREF="${p}misc/svc_cert-generate.html?action=generate_selfsigned;svcnum=$svcnum">Re-generate self-signed</A>).
113 include('/elements/popup_link.html', {
114 'action' => $p."edit/svc_cert/import_certificate.html".
116 'label' => 'Import issued certificate', #link
117 'actionlabel' => 'Import issued certificate', #title
121 #'color' => '#ff0000',
126 $out .= '<PRE><FONT STYLE="font-family:monospace">'.
127 $svc_cert->certificate.
131 } elsif ( $svc_cert->csr ) {
132 my $svcnum = $svc_cert->svcnum;
133 qq(<A HREF="${p}misc/svc_cert-generate.html?action=generate_selfsigned;svcnum=$svcnum">Generate self-signed</A>);
140 'value_callback'=> sub {
141 my $svc_cert = shift;
142 if ( $svc_cert->cacert ) {
144 my %hash = $svc_cert->check_cacert;
146 tie my %w, 'Tie::IxHash',
147 'subject' => 'Issued to',
148 'issuer' => 'Issued by',
151 my $out = '<TABLE><TR><TD>';
153 foreach my $w ( keys %w ) {
155 $out .= include('/elements/table-grid.html'). #'<TABLE>'.
156 '<TR><TH COLSPAN=2 BGCOLOR="#cccccc" ALIGN="center">'.
157 $w{$w}. '</TH></TR>';
159 my $col = $svc_cert->subj_col;
161 my $subj = $hash{$w};
162 foreach my $key (keys %$col) { #( keys %$subj ) {
163 $out .= "<TR><TD>". $labels{$col->{$key}}. "</TD>".
164 "<TD>". $subj->{$key}. "</TD></TR>";
167 $out .= '</TABLE></TD><TD>';
169 $out .= '</TD></TR></TABLE>';
172 '<TR><TH ALIGN="right">Serial number</TH>'.
173 "<TD>$hash{serial}</TD></TR>".
174 '<TR><TH ALIGN="right">Valid</TH>'.
175 "<TD>$hash{notBefore} - $hash{notAfter}</TD></TR>".
178 $out .= '<PRE><FONT STYLE="font-family:monospace">'.
179 $svc_cert->certificate.
186 my $svcnum = $svc_cert->svcnum;
188 include('/elements/popup_link.html', {
189 'action' => $p."edit/svc_cert/import_cacert.html".
191 'label' => 'Import certificate authority chain',#link
192 'actionlabel' => 'Import certificate authority chain',#title
196 #'color' => '#ff0000',
197 }). ' (optional)'.