File Coverage

lib/Mozilla/IntermediateCerts/Cert.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 20 20 100.0


line stmt bran cond sub pod time code
1             package Mozilla::IntermediateCerts::Cert;
2              
3 1     1   5 use strict;
  1         2  
  1         26  
4 1     1   11 use warnings;
  1         2  
  1         25  
5              
6 1     1   4 use utf8;
  1         2  
  1         5  
7 1     1   16 use Moo;
  1         2  
  1         7  
8              
9 1     1   278 use namespace::clean;
  1         3  
  1         6  
10              
11             # ABSTRACT: Wrapper for handling Mozilla Intermediate certificate
12              
13             our $VERSION = 'v0.0003';
14              
15             =head1 NAME
16            
17             Mozilla::IntermediateCerts::Cert
18            
19             =head1 WARNING
20            
21             This module is in early development and may change.
22            
23             =head1 SYNOPSIS
24            
25             $cert = Mozilla::IntermediateCerts::Cert( \%row )
26            
27             =cut
28            
29             =head1 DESCRIPTION
30              
31             This is a module f or parsing a hashref of data taken from the Mozilla intermediate certificate list.
32              
33             https://wiki.mozilla.org/CA/Intermediate_Certificates
34            
35             This is a work in progress and contains incomplete test code, methods are likely to be refactored, you have been warned.
36            
37            
38             =head1 METHODS
39              
40             =cut
41              
42             has ca_owner => ( is => 'rw' );
43             has parent_name => ( is => 'rw' );
44             has certificate_name => ( is => 'rw' );
45             has certificate_issuer_common_name => ( is => 'rw' );
46             has certificate_issuer_organization => ( is => 'rw' );
47             has certificate_subject_common_name => ( is => 'rw' );
48             has certificate_subject_organization => ( is => 'rw' );
49             has certificate_serial_number => ( is => 'rw' );
50             has sha_256_fingerprint => ( is => 'rw' );
51             has certificate_id => ( is => 'rw' );
52             has valid_from_gmt => ( is => 'rw' );
53             has valid_to_gmt => ( is => 'rw' );
54             has public_key_algorithm => ( is => 'rw' );
55             has signature_hash_algorithm => ( is => 'rw' );
56             has extended_key_usage => ( is => 'rw' );
57             has cp_cps_same_as_parent => ( is => 'rw' );
58             has certificate_policy_cp => ( is => 'rw' );
59             has certification_practice_statement_cps => ( is => 'rw' );
60             has audits_same_as_parent => ( is => 'rw' );
61             has standard_audit => ( is => 'rw' );
62             has br_audit => ( is => 'rw' );
63             has auditor => ( is => 'rw' );
64             has standard_audit_statement_dt => ( is => 'rw' );
65             has management_assertions_by => ( is => 'rw' );
66             has comments => ( is => 'rw' );
67             has pem_info => ( is => 'rw' );
68              
69             around BUILDARGS => sub {
70             my ( $orig, $class, @args ) = @_;
71             my %newargs;
72             for my $key ( keys %{ $args[0] } )
73             {
74             my $newkey = lc $key;
75             $newkey =~ s/\W+/_/g;
76             $newargs{$newkey} = $args[0]->{$key};
77             }
78             return $class->$orig(\%newargs);
79             };
80              
81              
82              
83             =head2 ca_owner
84              
85             returns CA Owner column
86             =cut
87             =head2 parent_name
88              
89             returns Parent Name column
90             =cut
91             =head2 certificate_name
92              
93             returns Certificate Name column
94             =cut
95             =head2 certificate_issuer_common_name
96              
97             returns Certificate Issuer Common Name column
98             =cut
99             =head2 certificate_issuer_organization
100              
101             returns Certificate Issuer Organization column
102             =cut
103             =head2 certificate_subject_common_name
104              
105             returns Certificate Subject Common Name column
106             =cut
107             =head2 certificate_subject_organization
108              
109             returns Certificate Subject Organization column
110             =cut
111             =head2 certificate_serial_number
112              
113             returns Certificate Serial Number column
114             =cut
115             =head2 sha_256_fingerprint
116              
117             returns SHA-256 Fingerprint column
118             =cut
119             =head2 certificate_id
120              
121             returns Certificate ID column
122             =cut
123             =head2 valid_from_gmt
124              
125             returns Valid From [GMT] column
126             =cut
127             =head2 valid_to_gmt
128              
129             returns Valid To [GMT] column
130             =cut
131             =head2 public_key_algorithm
132              
133             returns Public Key Algorithm column
134             =cut
135             =head2 signature_hash_algorithm
136              
137             returns Signature Hash Algorithm column
138             =cut
139             =head2 extended_key_usage
140              
141             returns Extended Key Usage column
142             =cut
143             =head2 cp_cps_same_as_parent
144              
145             returns CP/CPS Same As Parent column
146             =cut
147             =head2 certificate_policy_cp
148              
149             returns Certificate Policy (CP) column
150             =cut
151             =head2 certification_practice_statement_cps
152              
153             returns Certification Practice Statement (CPS) column
154             =cut
155             =head2 audits_same_as_parent
156              
157             returns Audits Same As Parent column
158             =cut
159             =head2 standard_audit
160              
161             returns Standard Audit column
162             =cut
163             =head2 br_audit
164              
165             returns BR Audit column
166             =cut
167             =head2 auditor
168              
169             returns Auditor column
170             =cut
171             =head2 standard_audit_statement_dt
172              
173             returns Standard Audit Statement Dt column
174             =cut
175             =head2 management_assertions_by
176              
177             returns Management Assertions By column
178             =cut
179             =head2 comments
180              
181             returns Comments column
182             =cut
183            
184             =head2 pem_info
185              
186             returns PEM Info column with enclosing quotes removed
187             =cut
188             around pem_info => sub {
189             my ($orig, $self) = @_;
190             $self->$orig( $self->$orig =~ s/'//gr );
191             };
192              
193              
194              
195             =head1 SOURCE CODE
196              
197             The source code for this module is held in a public git repository on Gitlab https://gitlab.com/rnewsham/mozilla_intermediate_cert
198              
199             =head1 LICENSE AND COPYRIGHT
200            
201             Copyright (c) 2019 Richard Newsham
202            
203             This library is free software; you can redistribute it and/or
204             modify it under the same terms as Perl itself.
205            
206             =head1 BUGS AND LIMITATIONS
207            
208             See rt.cpan.org for current bugs, if any.
209            
210             =head1 INCOMPATIBILITIES
211            
212             None known.
213            
214             =head1 DEPENDENCIES
215              
216             Moo
217             =cut
218              
219             1;