| 1 | package SBOM::CycloneDX::CryptoProperties::CertificateProperties; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use 5.010001; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | ▶ | use utf8; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 1 | ▶ | use SBOM::CycloneDX::Timestamp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 1 | ▶ | use Types::Standard qw(Str InstanceOf); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 1 | ▶ | use Types::TypeTiny qw(ArrayLike); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | |||||||||||
| 13 | 1 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | 1 | ▶ | use namespace::autoclean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | |||||||||||
| 16 | 1 | extends 'SBOM::CycloneDX::Base'; | |||||||||
| 17 | |||||||||||
| 18 | 1 | has serial_number => (is => 'rw', isa => Str); | |||||||||
| 19 | 1 | has subject_name => (is => 'rw', isa => Str); | |||||||||
| 20 | 1 | has issuer_name => (is => 'rw', isa => Str); | |||||||||
| 21 | |||||||||||
| 22 | has not_valid_before => ( | ||||||||||
| 23 | is => 'rw', | ||||||||||
| 24 | isa => InstanceOf ['SBOM::CycloneDX::Timestamp'], | ||||||||||
| 25 | 0 | ▶ | coerce => sub { ref($_[0]) ? $_[0] : SBOM::CycloneDX::Timestamp->new($_[0]) } | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||
| 26 | 1 | ); | |||||||||
| 27 | |||||||||||
| 28 | has not_valid_after => ( | ||||||||||
| 29 | is => 'rw', | ||||||||||
| 30 | isa => InstanceOf ['SBOM::CycloneDX::Timestamp'], | ||||||||||
| 31 | 0 | ▶ | coerce => sub { ref($_[0]) ? $_[0] : SBOM::CycloneDX::Timestamp->new($_[0]) } | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||
| 32 | 1 | ); | |||||||||
| 33 | |||||||||||
| 34 | 1 | has signature_algorithm_ref => (is => 'rw', isa => Str); # [DEPRECATED 1.7] Bom-ref like | |||||||||
| 35 | 1 | has subject_public_key_ref => (is => 'rw', isa => Str); # [DEPRECATED 1.7] Bom-ref like | |||||||||
| 36 | 1 | has certificate_format => (is => 'rw', isa => Str); | |||||||||
| 37 | 1 | has certificate_extension => (is => 'rw', isa => Str); # [DEPRECATED 1.7] | |||||||||
| 38 | 1 | has certificate_file_extension => (is => 'rw', isa => Str); | |||||||||
| 39 | |||||||||||
| 40 | 1 | has fingerprint => (is => 'rw', isa => InstanceOf ['SBOM::CycloneDX::Hash']); | |||||||||
| 41 | |||||||||||
| 42 | has certificate_state => ( | ||||||||||
| 43 | is => 'rw', | ||||||||||
| 44 | isa => ArrayLike [InstanceOf ['SBOM::CycloneDX::CryptoProperties::CertificateState']], | ||||||||||
| 45 | 0 | ▶ | default => sub { SBOM::CycloneDX::List->new } | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 46 | 1 | ); | |||||||||
| 47 | |||||||||||
| 48 | has creation_date => ( | ||||||||||
| 49 | is => 'rw', | ||||||||||
| 50 | isa => InstanceOf ['SBOM::CycloneDX::Timestamp'], | ||||||||||
| 51 | 0 | ▶ | coerce => sub { ref($_[0]) ? $_[0] : SBOM::CycloneDX::Timestamp->new($_[0]) } | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||
| 52 | 1 | ); | |||||||||
| 53 | |||||||||||
| 54 | has activation_date => ( | ||||||||||
| 55 | is => 'rw', | ||||||||||
| 56 | isa => InstanceOf ['SBOM::CycloneDX::Timestamp'], | ||||||||||
| 57 | 0 | ▶ | coerce => sub { ref($_[0]) ? $_[0] : SBOM::CycloneDX::Timestamp->new($_[0]) } | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||
| 58 | 1 | ); | |||||||||
| 59 | |||||||||||
| 60 | has deactivation_date => ( | ||||||||||
| 61 | is => 'rw', | ||||||||||
| 62 | isa => InstanceOf ['SBOM::CycloneDX::Timestamp'], | ||||||||||
| 63 | 0 | ▶ | coerce => sub { ref($_[0]) ? $_[0] : SBOM::CycloneDX::Timestamp->new($_[0]) } | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||
| 64 | 1 | ); | |||||||||
| 65 | |||||||||||
| 66 | has revocation_date => ( | ||||||||||
| 67 | is => 'rw', | ||||||||||
| 68 | isa => InstanceOf ['SBOM::CycloneDX::Timestamp'], | ||||||||||
| 69 | 0 | ▶ | coerce => sub { ref($_[0]) ? $_[0] : SBOM::CycloneDX::Timestamp->new($_[0]) } | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||
| 70 | 1 | ); | |||||||||
| 71 | |||||||||||
| 72 | has destruction_date => ( | ||||||||||
| 73 | is => 'rw', | ||||||||||
| 74 | isa => InstanceOf ['SBOM::CycloneDX::Timestamp'], | ||||||||||
| 75 | 0 | ▶ | coerce => sub { ref($_[0]) ? $_[0] : SBOM::CycloneDX::Timestamp->new($_[0]) } | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||
| 76 | 1 | ); | |||||||||
| 77 | |||||||||||
| 78 | has certificate_extensions => ( | ||||||||||
| 79 | is => 'rw', | ||||||||||
| 80 | isa => ArrayLike [InstanceOf ['SBOM::CycloneDX::CryptoProperties::CertificateExtension']], | ||||||||||
| 81 | 0 | ▶ | default => sub { SBOM::CycloneDX::List->new } | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 82 | 1 | ); | |||||||||
| 83 | |||||||||||
| 84 | has related_cryptographic_assets => ( | ||||||||||
| 85 | is => 'rw', | ||||||||||
| 86 | isa => ArrayLike [InstanceOf ['SBOM::CycloneDX::CryptoProperties::RelatedCryptographicAsset']], | ||||||||||
| 87 | 0 | ▶ | default => sub { SBOM::CycloneDX::List->new } | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 88 | 1 | ); | |||||||||
| 89 | |||||||||||
| 90 | 0 | ▶ | sub TO_JSON { | ||||||||
|
Subroutine
TO_JSON: not called CC=20 SCAR=60.4
Pod
documented
| |||||||||||
| 91 | |||||||||||
| 92 | 0 | my $self = shift; | |||||||||
| 93 | |||||||||||
| 94 | 0 | my $json = {}; | |||||||||
| 95 | |||||||||||
| 96 | 0 | ▶ | $json->{serialNumber} = $self->serial_number if $self->serial_number; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 97 | 0 | ▶ | $json->{subjectName} = $self->subject_name if $self->subject_name; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 98 | 0 | ▶ | $json->{issuerName} = $self->issuer_name if $self->issuer_name; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 99 | 0 | ▶ | $json->{notValidBefore} = $self->not_valid_before if $self->not_valid_before; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 100 | 0 | ▶ | $json->{notValidAfter} = $self->not_valid_after if $self->not_valid_after; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 101 | 0 | ▶ | $json->{signatureAlgorithmRef} = $self->signature_algorithm_ref if $self->signature_algorithm_ref; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 102 | 0 | ▶ | $json->{subjectPublicKeyRef} = $self->subject_public_key_ref if $self->subject_public_key_ref; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 103 | 0 | ▶ | $json->{certificateFormat} = $self->certificate_format if $self->certificate_format; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 104 | 0 | ▶ | $json->{certificateExtension} = $self->certificate_extension if $self->certificate_extension; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 105 | 0 | ▶ | $json->{certificateFileExtension} = $self->certificate_file_extension if $self->certificate_file_extension; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 106 | 0 | ▶ | $json->{fingerprint} = $self->fingerprint if $self->fingerprint; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 107 | 0 | ▶ | $json->{certificateState} = $self->certificate_state if @{$self->certificate_state}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 108 | 0 | ▶ | $json->{creationDate} = $self->creation_date if $self->creation_date; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 109 | 0 | ▶ | $json->{activationDate} = $self->activation_date if $self->activation_date; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 110 | 0 | ▶ | $json->{deactivationDate} = $self->deactivation_date if $self->deactivation_date; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 111 | 0 | ▶ | $json->{revocationDate} = $self->revocation_date if $self->revocation_date; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 112 | 0 | ▶ | $json->{destructionDate} = $self->destruction_date if $self->destruction_date; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 113 | 0 | ▶ | $json->{certificateExtensions} = $self->certificate_extensions if @{$self->certificate_extensions}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 114 | 0 | ▶ | $json->{relatedCryptographicAssets} = $self->related_cryptographic_assets if @{$self->related_cryptographic_assets}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 115 | |||||||||||
| 116 | 0 | return $json; | |||||||||
| 117 | |||||||||||
| 118 | } | ||||||||||
| 119 | |||||||||||
| 120 | 1 | 1; | |||||||||
| 121 | |||||||||||
| 122 | =encoding utf-8 | ||||||||||
| 123 | |||||||||||
| 124 | =head1 NAME | ||||||||||
| 125 | |||||||||||
| 126 | SBOM::CycloneDX::CryptoProperties::CertificateProperties - Properties for cryptographic | ||||||||||
| 127 | assets of asset type 'certificate' | ||||||||||
| 128 | |||||||||||
| 129 | =head1 SYNOPSIS | ||||||||||
| 130 | |||||||||||
| 131 | SBOM::CycloneDX::CryptoProperties::CertificateProperties->new(); | ||||||||||
| 132 | |||||||||||
| 133 | |||||||||||
| 134 | =head1 DESCRIPTION | ||||||||||
| 135 | |||||||||||
| 136 | L<SBOM::CycloneDX::CryptoProperties::CertificateProperties> specifies the properties for | ||||||||||
| 137 | cryptographic assets of asset type 'certificate'. | ||||||||||
| 138 | |||||||||||
| 139 | =head2 METHODS | ||||||||||
| 140 | |||||||||||
| 141 | L<SBOM::CycloneDX::CryptoProperties::CertificateProperties> inherits all methods from L<SBOM::CycloneDX::Base> | ||||||||||
| 142 | and implements the following new ones. | ||||||||||
| 143 | |||||||||||
| 144 | =over | ||||||||||
| 145 | |||||||||||
| 146 | =item SBOM::CycloneDX::CryptoProperties::CertificateProperties->new( %PARAMS ) | ||||||||||
| 147 | |||||||||||
| 148 | Properties: | ||||||||||
| 149 | |||||||||||
| 150 | =over | ||||||||||
| 151 | |||||||||||
| 152 | =item * C<activation_date>, The date and time (timestamp) when the certificate was activated. | ||||||||||
| 153 | |||||||||||
| 154 | =item * C<certificate_extension>, [DEPRECATED] This will be removed in a future version. | ||||||||||
| 155 | Use C<certificate_file_extension> instead. The file extension of the certificate. | ||||||||||
| 156 | |||||||||||
| 157 | =item * C<certificate_extensions>, A certificate extension is a field that | ||||||||||
| 158 | provides additional information about the certificate or its use. Extensions | ||||||||||
| 159 | are used to convey additional information beyond the standard fields. | ||||||||||
| 160 | |||||||||||
| 161 | See L<SBOM::CycloneDX::CryptoProperties::CertificateExtension> | ||||||||||
| 162 | |||||||||||
| 163 | =item * C<certificate_file_extension>, The file extension of the certificate | ||||||||||
| 164 | |||||||||||
| 165 | =item * C<certificate_format>, The format of the certificate | ||||||||||
| 166 | |||||||||||
| 167 | =item * C<certificate_state>, Certificate Lifecycle State | ||||||||||
| 168 | |||||||||||
| 169 | The certificate lifecycle is a comprehensive process that manages digital | ||||||||||
| 170 | certificates from their initial creation to eventual expiration or revocation. | ||||||||||
| 171 | It typically involves several stages. | ||||||||||
| 172 | |||||||||||
| 173 | See L<SBOM::CycloneDX::CertificateProperties::CertificateState> | ||||||||||
| 174 | |||||||||||
| 175 | =item * C<creation_date>, The date and time (timestamp) when the certificate was created or pre-activated. | ||||||||||
| 176 | |||||||||||
| 177 | =item * C<deactivation_date>, The date and time (timestamp) when the related certificate was deactivated. | ||||||||||
| 178 | |||||||||||
| 179 | =item * C<destruction_date>, The date and time (timestamp) when the certificate was destroyed. | ||||||||||
| 180 | |||||||||||
| 181 | =item * C<fingerprint>, The fingerprint is a cryptographic hash of the certificate excluding it's signature. | ||||||||||
| 182 | |||||||||||
| 183 | See L<SBOM::CycloneDX::Hash> | ||||||||||
| 184 | |||||||||||
| 185 | =item * C<issuer_name>, The issuer name for the certificate | ||||||||||
| 186 | |||||||||||
| 187 | =item * C<not_valid_after>, The date and time according to ISO-8601 standard | ||||||||||
| 188 | from which the certificate is not valid anymore | ||||||||||
| 189 | |||||||||||
| 190 | =item * C<not_valid_before>, The date and time according to ISO-8601 standard | ||||||||||
| 191 | from which the certificate is valid | ||||||||||
| 192 | |||||||||||
| 193 | =item * C<related_cryptographic_assets>, | ||||||||||
| 194 | |||||||||||
| 195 | =item * C<revocation_date>, The date and time (timestamp) when the certificate was revoked. | ||||||||||
| 196 | |||||||||||
| 197 | =item * C<serial_number>, The serial number is a unique identifier for the certificate issued by a CA. | ||||||||||
| 198 | |||||||||||
| 199 | =item * C<signature_algorithm_ref>, [DEPRECATED] This will be removed in a future version. Use C<related_cryptographic_assets> instead. | ||||||||||
| 200 | The bom-ref to signature algorithm used by the certificate. | ||||||||||
| 201 | |||||||||||
| 202 | =item * C<subject_name>, The subject name for the certificate | ||||||||||
| 203 | |||||||||||
| 204 | =item * C<subject_public_key_ref>, [DEPRECATED] This will be removed in a future version. Use C<related_cryptographic_assets> instead. | ||||||||||
| 205 | The bom-ref to the public key of the subject. | ||||||||||
| 206 | |||||||||||
| 207 | =back | ||||||||||
| 208 | |||||||||||
| 209 | =item $certificate_properties->activation_date | ||||||||||
| 210 | |||||||||||
| 211 | =item $certificate_properties->certificate_extension | ||||||||||
| 212 | |||||||||||
| 213 | =item $certificate_properties->certificate_extensions | ||||||||||
| 214 | |||||||||||
| 215 | =item $certificate_properties->certificate_format | ||||||||||
| 216 | |||||||||||
| 217 | =item $certificate_properties->certificate_state | ||||||||||
| 218 | |||||||||||
| 219 | =item $certificate_properties->creation_date | ||||||||||
| 220 | |||||||||||
| 221 | =item $certificate_properties->deactivation_date | ||||||||||
| 222 | |||||||||||
| 223 | =item $certificate_properties->destruction_date | ||||||||||
| 224 | |||||||||||
| 225 | =item $certificate_properties->fingerprint | ||||||||||
| 226 | |||||||||||
| 227 | =item $certificate_properties->issuer_name | ||||||||||
| 228 | |||||||||||
| 229 | =item $certificate_properties->not_valid_after | ||||||||||
| 230 | |||||||||||
| 231 | =item $certificate_properties->not_valid_before | ||||||||||
| 232 | |||||||||||
| 233 | =item $certificate_properties->related_cryptographic_assets | ||||||||||
| 234 | |||||||||||
| 235 | =item $certificate_properties->revocation_date | ||||||||||
| 236 | |||||||||||
| 237 | =item $certificate_properties->serial_number | ||||||||||
| 238 | |||||||||||
| 239 | =item $certificate_properties->signature_algorithm_ref | ||||||||||
| 240 | |||||||||||
| 241 | =item $certificate_properties->subject_name | ||||||||||
| 242 | |||||||||||
| 243 | =item $certificate_properties->subject_public_key_ref | ||||||||||
| 244 | |||||||||||
| 245 | =back | ||||||||||
| 246 | |||||||||||
| 247 | |||||||||||
| 248 | |||||||||||
| 249 | =head1 SUPPORT | ||||||||||
| 250 | |||||||||||
| 251 | =head2 Bugs / Feature Requests | ||||||||||
| 252 | |||||||||||
| 253 | Please report any bugs or feature requests through the issue tracker | ||||||||||
| 254 | at L<https://github.com/giterlizzi/perl-SBOM-CycloneDX/issues>. | ||||||||||
| 255 | You will be notified automatically of any progress on your issue. | ||||||||||
| 256 | |||||||||||
| 257 | =head2 Source Code | ||||||||||
| 258 | |||||||||||
| 259 | This is open source software. The code repository is available for | ||||||||||
| 260 | public review and contribution under the terms of the license. | ||||||||||
| 261 | |||||||||||
| 262 | L<https://github.com/giterlizzi/perl-SBOM-CycloneDX> | ||||||||||
| 263 | |||||||||||
| 264 | git clone https://github.com/giterlizzi/perl-SBOM-CycloneDX.git | ||||||||||
| 265 | |||||||||||
| 266 | |||||||||||
| 267 | =head1 AUTHOR | ||||||||||
| 268 | |||||||||||
| 269 | =over 4 | ||||||||||
| 270 | |||||||||||
| 271 | =item * Giuseppe Di Terlizzi <gdt@cpan.org> | ||||||||||
| 272 | |||||||||||
| 273 | =back | ||||||||||
| 274 | |||||||||||
| 275 | |||||||||||
| 276 | =head1 LICENSE AND COPYRIGHT | ||||||||||
| 277 | |||||||||||
| 278 | This software is copyright (c) 2025-2026 by Giuseppe Di Terlizzi. | ||||||||||
| 279 | |||||||||||
| 280 | This is free software; you can redistribute it and/or modify it under | ||||||||||
| 281 | the same terms as the Perl 5 programming language system itself. | ||||||||||
| 282 | |||||||||||
| 283 | =cut | ||||||||||