CycloneDX/CryptoProperties.pm

filter: Statementstmt 71.6% 43 / 60 Branchbran 0.0% 0 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 70.5% 12 / 17 Podpod 100% 1 / 1 totaltotal 62.2% 56 / 90 CC 7 SCAR 28.9
CC
7
Cov
60%
TO_JSON
56.0
__ANON__
2.0
__ANON__
2.0
CRAP 17.9
« CycloneDX/Component/Commit.pm ↑ Summary CycloneDX/Declarations/Data.pm »
1 package SBOM::CycloneDX::CryptoProperties;
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::CryptoProperties::AlgorithmProperties;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use SBOM::CycloneDX::CryptoProperties::CertificateProperties;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use SBOM::CycloneDX::CryptoProperties::RelatedCryptoMaterialProperties;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use SBOM::CycloneDX::CryptoProperties::ProtocolProperties;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use SBOM::CycloneDX::Enum;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 1 ▶use Types::Standard qw(Str Enum InstanceOf);
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 1 extends 'SBOM::CycloneDX::Base';
20  
21 1 has asset_type => (is => 'rw', isa => Enum [SBOM::CycloneDX::Enum->values('CRYPTO_ASSET_TYPE')], required => 1);
22  
23 has algorithm_properties => (
24 is => 'rw',
25 isa => InstanceOf ['SBOM::CycloneDX::CryptoProperties::AlgorithmProperties'],
26 0 ▶ default => sub { SBOM::CycloneDX::CryptoProperties::AlgorithmProperties->new }
Subroutine __ANON__: not called CC=1 SCAR=6.9
27 1 );
28  
29 has certificate_properties => (
30 is => 'rw',
31 isa => InstanceOf ['SBOM::CycloneDX::CryptoProperties::CertificateProperties'],
32 0 ▶ default => sub { SBOM::CycloneDX::CryptoProperties::CertificateProperties->new }
Subroutine __ANON__: not called CC=1 SCAR=6.9
33 1 );
34  
35 has related_crypto_material_properties => (
36 is => 'rw',
37 isa => InstanceOf ['SBOM::CycloneDX::CryptoProperties::RelatedCryptoMaterialProperties'],
38 0 ▶ default => sub { SBOM::CycloneDX::CryptoProperties::RelatedCryptoMaterialProperties->new }
Subroutine __ANON__: not called CC=1 SCAR=6.9
39 1 );
40  
41 has protocol_properties => (
42 is => 'rw',
43 isa => InstanceOf ['SBOM::CycloneDX::CryptoProperties::ProtocolProperties'],
44 0 ▶ default => sub { SBOM::CycloneDX::CryptoProperties::ProtocolProperties->new }
Subroutine __ANON__: not called CC=1 SCAR=6.9
45 1 );
46  
47 1 has oid => (is => 'rw', isa => Str);
48  
49 0 ▶sub TO_JSON {
Subroutine TO_JSON: not called CC=7 SCAR=40.3
Pod documented
50  
51 0 my $self = shift;
52  
53 0 my $json = {};
54  
55 0 ▶ $json->{assetType} = $self->asset_type if $self->asset_type;
Branch: 1 branch
BranchTrueFalseTotal
if $self->asset_type 0 0 0
56  
57 0 ▶ $json->{algorithmProperties} = $self->algorithm_properties if %{$self->algorithm_properties->TO_JSON};
Branch: 1 branch
BranchTrueFalseTotal
if %{$self->algorithm_properties->TO_JSON;} 0 0 0
58 0 ▶ $json->{certificateProperties} = $self->certificate_properties if %{$self->certificate_properties->TO_JSON};
Branch: 1 branch
BranchTrueFalseTotal
if %{$self->certificate_properties->TO_JSON;} 0 0 0
59  
60 $json->{relatedCryptoMaterialProperties} = $self->related_crypto_material_properties
61 0 ▶ if %{$self->related_crypto_material_properties->TO_JSON};
Branch: 1 branch
BranchTrueFalseTotal
if %{$self->related_crypto_material_properties->TO_JSON;} 0 0 0
62  
63 0 ▶ $json->{protocolProperties} = $self->protocol_properties if %{$self->protocol_properties->TO_JSON};
Branch: 1 branch
BranchTrueFalseTotal
if %{$self->protocol_properties->TO_JSON;} 0 0 0
64  
65 0 ▶ $json->{oid} = $self->oid if $self->oid;
Branch: 1 branch
BranchTrueFalseTotal
if $self->oid 0 0 0
66  
67 0 return $json;
68  
69 }
70  
71 1 1;
72  
73 =encoding utf-8
74  
75 =head1 NAME
76  
77 SBOM::CycloneDX::CryptoProperties - Cryptographic Properties
78  
79 =head1 SYNOPSIS
80  
81 SBOM::CycloneDX::CryptoProperties->new();
82  
83  
84 =head1 DESCRIPTION
85  
86 L<SBOM::CycloneDX::CryptoProperties> Cryptographic assets have properties
87 that uniquely define them and that make them actionable for further
88 reasoning. As an example, it makes a difference if one knows the algorithm
89 family (e.g. AES) or the specific variant or instantiation (e.g.
90 AES-128-GCM). This is because the security level and the algorithm
91 primitive (authenticated encryption) are only defined by the definition of
92 the algorithm variant. The presence of a weak cryptographic algorithm like
93 SHA1 vs. HMAC-SHA1 also makes a difference.
94  
95 =head2 METHODS
96  
97 L<SBOM::CycloneDX::CryptoProperties> inherits all methods from L<SBOM::CycloneDX::Base>
98 and implements the following new ones.
99  
100 =over
101  
102 =item SBOM::CycloneDX::CryptoProperties->new( %PARAMS )
103  
104 Properties:
105  
106 =over
107  
108 =item * C<algorithm_properties>, Additional properties specific to a
109 cryptographic algorithm.
110  
111 =item * C<asset_type>, Cryptographic assets occur in several forms.
112 Algorithms and protocols are most commonly implemented in specialized
113 cryptographic libraries. They may, however, also be 'hardcoded' in software
114 components. Certificates and related cryptographic material like keys,
115 tokens, secrets or passwords are other cryptographic assets to be modelled.
116  
117 =item * C<certificate_properties>, Properties for cryptographic assets of
118 asset type 'certificate'
119  
120 =item * C<oid>, The object identifier (OID) of the cryptographic asset.
121  
122 =item * C<protocol_properties>, Properties specific to cryptographic assets
123 of type: `protocol`.
124  
125 =item * C<related_crypto_material_properties>, Properties for cryptographic
126 assets of asset type: `related-crypto-material`
127  
128 =back
129  
130 =item $crypto_properties->algorithm_properties
131  
132 =item $crypto_properties->asset_type
133  
134 =item $crypto_properties->certificate_properties
135  
136 =item $crypto_properties->oid
137  
138 =item $crypto_properties->protocol_properties
139  
140 =item $crypto_properties->related_crypto_material_properties
141  
142 =back
143  
144  
145 =head1 SUPPORT
146  
147 =head2 Bugs / Feature Requests
148  
149 Please report any bugs or feature requests through the issue tracker
150 at L<https://github.com/giterlizzi/perl-SBOM-CycloneDX/issues>.
151 You will be notified automatically of any progress on your issue.
152  
153 =head2 Source Code
154  
155 This is open source software. The code repository is available for
156 public review and contribution under the terms of the license.
157  
158 L<https://github.com/giterlizzi/perl-SBOM-CycloneDX>
159  
160 git clone https://github.com/giterlizzi/perl-SBOM-CycloneDX.git
161  
162  
163 =head1 AUTHOR
164  
165 =over 4
166  
167 =item * Giuseppe Di Terlizzi <gdt@cpan.org>
168  
169 =back
170  
171  
172 =head1 LICENSE AND COPYRIGHT
173  
174 This software is copyright (c) 2025-2026 by Giuseppe Di Terlizzi.
175  
176 This is free software; you can redistribute it and/or modify it under
177 the same terms as the Perl 5 programming language system itself.
178  
179 =cut
« CycloneDX/Component/Commit.pm ↑ Summary CycloneDX/Declarations/Data.pm »