File Coverage

blib/lib/STIX/Observable/Type/X509V3Extensions.pm
Criterion Covered Total %
statement 26 26 100.0
branch n/a
condition n/a
subroutine 9 9 100.0
pod n/a
total 35 35 100.0


line stmt bran cond sub pod time code
1             package STIX::Observable::Type::X509V3Extensions;
2              
3 24     24   545 use 5.010001;
  24         110  
4 24     24   156 use strict;
  24         52  
  24         674  
5 24     24   120 use warnings;
  24         53  
  24         1357  
6 24     24   161 use utf8;
  24         99  
  24         251  
7              
8 24     24   1100 use Moo;
  24         69  
  24         260  
9 24     24   11800 use Types::Standard qw(Str InstanceOf);
  24         79  
  24         288  
10 24     24   49217 use namespace::autoclean;
  24         64  
  24         258  
11              
12             extends 'STIX::Object';
13              
14 24         3279 use constant SCHEMA =>
15 24     24   2836 'http://raw.githubusercontent.com/oasis-open/cti-stix2-json-schemas/stix2.1/schemas/observables/x509-certificate.json#/definitions/x509-v3-extensions-type';
  24         91  
16              
17 24         12491 use constant PROPERTIES => (qw(
18             basic_constraints name_constraints policy_constraints key_usage extended_key_usage subject_key_identifier
19             authority_key_identifier subject_alternative_name issuer_alternative_name subject_directory_attributes
20             crl_distribution_points inhibit_any_policy private_key_usage_period_not_before
21             private_key_usage_period_not_after certificate_policies policy_mappings
22 24     24   189 ));
  24         68  
23              
24             has basic_constraints => (is => 'rw', isa => Str);
25             has name_constraints => (is => 'rw', isa => Str);
26             has policy_constraints => (is => 'rw', isa => Str);
27             has key_usage => (is => 'rw', isa => Str);
28             has extended_key_usage => (is => 'rw', isa => Str);
29             has subject_key_identifier => (is => 'rw', isa => Str);
30             has authority_key_identifier => (is => 'rw', isa => Str);
31             has subject_alternative_name => (is => 'rw', isa => Str);
32             has issuer_alternative_name => (is => 'rw', isa => Str);
33             has subject_directory_attributes => (is => 'rw', isa => Str);
34             has crl_distribution_points => (is => 'rw', isa => Str);
35             has inhibit_any_policy => (is => 'rw', isa => Str);
36              
37             has private_key_usage_period_not_before => (
38             is => 'rw',
39             isa => InstanceOf ['STIX::Common::Timestamp'],
40             coerce => sub { ref($_[0]) ? $_[0] : STIX::Common::Timestamp->new($_[0]) },
41             );
42              
43             has private_key_usage_period_not_after => (
44             is => 'rw',
45             isa => InstanceOf ['STIX::Common::Timestamp'],
46             coerce => sub { ref($_[0]) ? $_[0] : STIX::Common::Timestamp->new($_[0]) },
47             );
48              
49             has certificate_policies => (is => 'rw', isa => Str);
50             has policy_mappings => (is => 'rw', isa => Str);
51              
52             1;
53              
54             =encoding utf-8
55              
56             =head1 NAME
57              
58             STIX::Observable::Type::X509V3Extensions - STIX Cyber-observable Object (SCO) - X.509 v3 Extensions Type
59              
60             =head1 SYNOPSIS
61              
62             use STIX::Observable::Type::X509V3Extensions;
63              
64             my $x509_v3_extensions_type = STIX::Observable::Type::X509V3Extensions->new();
65              
66              
67             =head1 DESCRIPTION
68              
69             Specifies any standard X.509 v3 extensions that may be used in the certificate.
70              
71              
72             =head2 METHODS
73              
74             L inherits all methods from L
75             and implements the following new ones.
76              
77             =over
78              
79             =item STIX::Observable::Type::X509V3Extensions->new(%properties)
80              
81             Create a new instance of L.
82              
83             =item $x509_v3_extensions_type->authority_key_identifier
84              
85             Specifies the identifier that provides a means of identifying the public
86             key corresponding to the private key used to sign a certificate.
87              
88             =item $x509_v3_extensions_type->basic_constraints
89              
90             Specifies a multi-valued extension which indicates whether a certificate is
91             a CA certificate.
92              
93             =item $x509_v3_extensions_type->certificate_policies
94              
95             Specifies a sequence of one or more policy information terms, each of which
96             consists of an object identifier (OID) and optional qualifiers.
97              
98             =item $x509_v3_extensions_type->crl_distribution_points
99              
100             Specifies how CRL information is obtained.
101              
102             =item $x509_v3_extensions_type->extended_key_usage
103              
104             Specifies a list of usages indicating purposes for which the certificate
105             public key can be used for.
106              
107             =item $x509_v3_extensions_type->inhibit_any_policy
108              
109             Specifies the number of additional certificates that may appear in the path
110             before anyPolicy is no longer permitted.
111              
112             =item $x509_v3_extensions_type->issuer_alternative_name
113              
114             Specifies the additional identities to be bound to the issuer of the
115             certificate.
116              
117             =item $x509_v3_extensions_type->key_usage
118              
119             Specifies a multi-valued extension consisting of a list of names of the
120             permitted key usages.
121              
122             =item $x509_v3_extensions_type->name_constraints
123              
124             Specifies a namespace within which all subject names in subsequent
125             certificates in a certification path MUST be located.
126              
127             =item $x509_v3_extensions_type->policy_constraints
128              
129             Specifies any constraints on path validation for certificates issued to
130             CAs.
131              
132             =item $x509_v3_extensions_type->policy_mappings
133              
134             Specifies one or more pairs of OIDs; each pair includes an
135             issuerDomainPolicy and a subjectDomainPolicy
136              
137             =item $x509_v3_extensions_type->private_key_usage_period_not_after
138              
139             Specifies the date on which the validity period ends for the private key,
140             if it is different from the validity period of the certificate.
141              
142             =item $x509_v3_extensions_type->private_key_usage_period_not_before
143              
144             Specifies the date on which the validity period begins for the private key,
145             if it is different from the validity period of the certificate.
146              
147             =item $x509_v3_extensions_type->subject_alternative_name
148              
149             Specifies the additional identities to be bound to the subject of the
150             certificate.
151              
152             =item $x509_v3_extensions_type->subject_directory_attributes
153              
154             Specifies the identification attributes (e.g., nationality) of the subject.
155              
156             =item $x509_v3_extensions_type->subject_key_identifier
157              
158             Specifies the identifier that provides a means of identifying certificates
159             that contain a particular public key.
160              
161             =back
162              
163              
164             =head2 HELPERS
165              
166             =over
167              
168             =item $x509_v3_extensions_type->TO_JSON
169              
170             Encode the object in JSON.
171              
172             =item $x509_v3_extensions_type->to_hash
173              
174             Return the object HASH.
175              
176             =item $x509_v3_extensions_type->to_string
177              
178             Encode the object in JSON.
179              
180             =item $x509_v3_extensions_type->validate
181              
182             Validate the object using JSON Schema
183             (see L).
184              
185             =back
186              
187              
188             =head1 SUPPORT
189              
190             =head2 Bugs / Feature Requests
191              
192             Please report any bugs or feature requests through the issue tracker
193             at L.
194             You will be notified automatically of any progress on your issue.
195              
196             =head2 Source Code
197              
198             This is open source software. The code repository is available for
199             public review and contribution under the terms of the license.
200              
201             L
202              
203             git clone https://github.com/giterlizzi/perl-STIX.git
204              
205              
206             =head1 AUTHOR
207              
208             =over 4
209              
210             =item * Giuseppe Di Terlizzi
211              
212             =back
213              
214              
215             =head1 LICENSE AND COPYRIGHT
216              
217             This software is copyright (c) 2024 by Giuseppe Di Terlizzi.
218              
219             This is free software; you can redistribute it and/or modify it under
220             the same terms as the Perl 5 programming language system itself.
221              
222             =cut