File Coverage

blib/lib/SBOM/CycloneDX/CryptoProperties/CertificateExtension.pm
Criterion Covered Total %
statement 23 30 76.6
branch 0 8 0.0
condition n/a
subroutine 8 9 88.8
pod 1 1 100.0
total 32 48 66.6


line stmt bran cond sub pod time code
1             package SBOM::CycloneDX::CryptoProperties::CertificateExtension;
2              
3 1     1   2337 use 5.010001;
  1         6  
4 1     1   6 use strict;
  1         2  
  1         24  
5 1     1   6 use warnings;
  1         3  
  1         71  
6 1     1   34 use utf8;
  1         3  
  1         9  
7              
8 1     1   36 use SBOM::CycloneDX::Enum;
  1         3  
  1         111  
9              
10 1     1   6 use Types::Standard qw(Str Enum);
  1         2  
  1         9  
11              
12 1     1   2267 use Moo;
  1         3  
  1         8  
13 1     1   466 use namespace::autoclean;
  1         3  
  1         11  
14              
15             extends 'SBOM::CycloneDX::Base';
16              
17             has common_extension_name => (is => 'rw', isa => Enum [SBOM::CycloneDX::Enum->values('COMMON_EXTENSION_NAME')]);
18             has common_extension_value => (is => 'rw', isa => Str);
19             has custom_extension_name => (is => 'rw', isa => Str);
20             has custom_extension_value => (is => 'rw', isa => Str);
21              
22             sub TO_JSON {
23              
24 0     0 1   my $self = shift;
25              
26 0           my $json = {};
27              
28 0 0         $json->{commonExtensionName} = $self->common_extension_name if $self->common_extension_name;
29 0 0         $json->{commonExtensionValue} = $self->common_extension_value if $self->common_extension_value;
30 0 0         $json->{customExtensionName} = $self->custom_extension_name if $self->custom_extension_name;
31 0 0         $json->{customExtensionValue} = $self->custom_extension_value if $self->custom_extension_value;
32              
33 0           return $json;
34              
35             }
36              
37             1;
38              
39             =encoding utf-8
40              
41             =head1 NAME
42              
43             SBOM::CycloneDX::CryptoProperties::CertificateExtension - Certificate Extensions
44              
45             =head1 SYNOPSIS
46              
47             SBOM::CycloneDX::CryptoProperties::CertificateExtension->new();
48              
49              
50             =head1 DESCRIPTION
51              
52             L A certificate
53             extension is a field that provides additional information about the
54             certificate or its use. Extensions are used to convey additional
55             information beyond the standard fields.
56              
57             =head2 METHODS
58              
59             L inherits all methods from L
60             and implements the following new ones.
61              
62             =over
63              
64             =item SBOM::CycloneDX::CryptoProperties::CertificateExtension->new( %PARAMS )
65              
66             Properties:
67              
68             =over
69              
70             =item * C, The name of the extension.
71              
72             =over
73              
74             =item * C, Specifies whether a certificate can be used as a
75             CA certificate or not.
76              
77             =item * C, Specifies the allowed uses of the public key in the
78             certificate.
79              
80             =item * C, Specifies additional purposes for which the public
81             key can be used.
82              
83             =item * C, Allows inclusion of additional names to
84             identify the entity associated with the certificate.
85              
86             =item * C, Identifies the public key of the CA that
87             issued the certificate.
88              
89             =item * C, Identifies the public key associated with the
90             entity the certificate was issued to.
91              
92             =item * C, Contains CA issuers and OCSP information.
93              
94             =item * C, Defines the policies under which the
95             certificate was issued and can be used.
96              
97             =item * C, Contains one or more URLs where a Certificate
98             Revocation List (CRL) can be obtained.
99              
100             =item * C, Shows that the certificate has been
101             publicly logged, which helps prevent the issuance of rogue certificates by a
102             CA. Log ID, timestamp and signature as proof
103              
104             =back
105              
106             =item * C, The value of the certificate extension.
107              
108             =back
109              
110             Custom extensions may convey application-specific or vendor-specific data not
111             covered by standard extensions. The structure and semantics of custom
112             extensions are typically defined outside of public standards. CycloneDX
113             leverages properties to support this capability.
114              
115             =over
116              
117             =item * C, The name for the custom certificate extension.
118              
119             =item * C, The description of the custom certificate extension.
120              
121             =back
122              
123             =item $certificate_extension->common_extension_name
124              
125             =item $certificate_extension->common_extension_value
126              
127             =item $certificate_extension->custom_extension_name
128              
129             =item $certificate_extension->custom_extension_value
130              
131             =back
132              
133             =head1 SUPPORT
134              
135             =head2 Bugs / Feature Requests
136              
137             Please report any bugs or feature requests through the issue tracker
138             at L.
139             You will be notified automatically of any progress on your issue.
140              
141             =head2 Source Code
142              
143             This is open source software. The code repository is available for
144             public review and contribution under the terms of the license.
145              
146             L
147              
148             git clone https://github.com/giterlizzi/perl-SBOM-CycloneDX.git
149              
150              
151             =head1 AUTHOR
152              
153             =over 4
154              
155             =item * Giuseppe Di Terlizzi
156              
157             =back
158              
159              
160             =head1 LICENSE AND COPYRIGHT
161              
162             This software is copyright (c) 2025-2026 by Giuseppe Di Terlizzi.
163              
164             This is free software; you can redistribute it and/or modify it under
165             the same terms as the Perl 5 programming language system itself.
166              
167             =cut