« CycloneDX/CryptoProperties/RelatedCryptoMaterialProperties.pm
↑ Summary
CycloneDX/ReleaseNotes.pm »
| 1 | package SBOM::CycloneDX::CryptoProperties::AlgorithmProperties; | ||||||||||
| 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::Enum; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 1 | ▶ | use SBOM::CycloneDX::Hash; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 1 | ▶ | use SBOM::CycloneDX::List; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | 1 | ▶ | use Types::Standard qw(Str Enum Num); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | 1 | ▶ | use Types::TypeTiny qw(ArrayLike); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | |||||||||||
| 15 | 1 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 16 | 1 | ▶ | use namespace::autoclean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 17 | |||||||||||
| 18 | 1 | extends 'SBOM::CycloneDX::Base'; | |||||||||
| 19 | |||||||||||
| 20 | 1 | has primitive => (is => 'rw', isa => Enum [SBOM::CycloneDX::Enum->values('CRYPTO_PRIMITIVE')]); | |||||||||
| 21 | 1 | has algorithm_family => (is => 'rw', isa => Str); | |||||||||
| 22 | 1 | has parameter_set_identifier => (is => 'rw', isa => Str); | |||||||||
| 23 | 1 | has curve => (is => 'rw', isa => Str); | |||||||||
| 24 | 1 | has execution_environment => (is => 'rw', isa => Str); | |||||||||
| 25 | 1 | has implementation_platform => | |||||||||
| 26 | (is => 'rw', isa => Enum [SBOM::CycloneDX::Enum->values('CRYPTO_IMPLEMENTATION_PLATFORM')]); | ||||||||||
| 27 | |||||||||||
| 28 | has certification_level => ( | ||||||||||
| 29 | is => 'rw', | ||||||||||
| 30 | isa => ArrayLike [Enum [SBOM::CycloneDX::Enum->values('CRYPTO_CERTIFICATION_LEVEL')]], | ||||||||||
| 31 | 0 | ▶ | default => sub { SBOM::CycloneDX::List->new } | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 32 | 1 | ); | |||||||||
| 33 | |||||||||||
| 34 | 1 | has mode => (is => 'rw', isa => Enum [SBOM::CycloneDX::Enum->values('CRYPTO_MODE')]); | |||||||||
| 35 | 1 | has padding => (is => 'rw', isa => Enum [SBOM::CycloneDX::Enum->values('CRYPTO_PADDING')]); | |||||||||
| 36 | |||||||||||
| 37 | has crypto_functions => ( | ||||||||||
| 38 | is => 'rw', | ||||||||||
| 39 | isa => ArrayLike [Enum [SBOM::CycloneDX::Enum->values('CRYPTO_FUNCTION')]], | ||||||||||
| 40 | 0 | ▶ | default => sub { SBOM::CycloneDX::List->new } | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 41 | 1 | ); | |||||||||
| 42 | |||||||||||
| 43 | 1 | has classical_security_level => (is => 'rw', isa => Num); | |||||||||
| 44 | 1 | has nist_quantum_security_level => (is => 'rw', isa => Num); | |||||||||
| 45 | |||||||||||
| 46 | 0 | ▶ | sub TO_JSON { | ||||||||
|
Subroutine
TO_JSON: not called CC=13 SCAR=52.0
Pod
documented
| |||||||||||
| 47 | |||||||||||
| 48 | 0 | my $self = shift; | |||||||||
| 49 | |||||||||||
| 50 | 0 | my $json = {}; | |||||||||
| 51 | |||||||||||
| 52 | 0 | ▶ | $json->{primitive} = $self->primitive if $self->primitive; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 53 | 0 | ▶ | $json->{algorithmFamily} = $self->algorithm_family if $self->algorithm_family; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 54 | 0 | ▶ | $json->{parameterSetIdentifier} = $self->parameter_set_identifier if $self->parameter_set_identifier; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 55 | 0 | ▶ | $json->{curve} = $self->curve if $self->curve; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 56 | 0 | ▶ | $json->{executionEnvironment} = $self->execution_environment if $self->execution_environment; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 57 | 0 | ▶ | $json->{implementationPlatform} = $self->implementation_platform if $self->implementation_platform; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 58 | 0 | ▶ | $json->{certificationLevel} = $self->certification_level if @{$self->certification_level}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 59 | 0 | ▶ | $json->{mode} = $self->mode if $self->mode; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 60 | 0 | ▶ | $json->{padding} = $self->padding if $self->padding; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 61 | 0 | ▶ | $json->{cryptoFunctions} = $self->crypto_functions if @{$self->crypto_functions}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 62 | 0 | ▶ | $json->{classicalSecurityLevel} = $self->classical_security_level if $self->classical_security_level; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 63 | 0 | ▶ | $json->{nistQuantumSecurityLevel} = $self->nist_quantum_security_level if $self->nist_quantum_security_level; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 64 | |||||||||||
| 65 | 0 | return $json; | |||||||||
| 66 | |||||||||||
| 67 | } | ||||||||||
| 68 | |||||||||||
| 69 | 1 | 1; | |||||||||
| 70 | |||||||||||
| 71 | =encoding utf-8 | ||||||||||
| 72 | |||||||||||
| 73 | =head1 NAME | ||||||||||
| 74 | |||||||||||
| 75 | SBOM::CycloneDX::CryptoProperties::AlgorithmProperties - Additional properties | ||||||||||
| 76 | specific to a cryptographic algorithm. | ||||||||||
| 77 | |||||||||||
| 78 | =head1 SYNOPSIS | ||||||||||
| 79 | |||||||||||
| 80 | SBOM::CycloneDX::CryptoProperties::AlgorithmProperties->new(); | ||||||||||
| 81 | |||||||||||
| 82 | |||||||||||
| 83 | =head1 DESCRIPTION | ||||||||||
| 84 | |||||||||||
| 85 | L<SBOM::CycloneDX::CryptoProperties::AlgorithmProperties> specifies additional | ||||||||||
| 86 | properties specific to a cryptographic algorithm. | ||||||||||
| 87 | |||||||||||
| 88 | =head2 METHODS | ||||||||||
| 89 | |||||||||||
| 90 | L<SBOM::CycloneDX::CryptoProperties::AlgorithmProperties> inherits all methods from L<SBOM::CycloneDX::Base> | ||||||||||
| 91 | and implements the following new ones. | ||||||||||
| 92 | |||||||||||
| 93 | =over | ||||||||||
| 94 | |||||||||||
| 95 | =item SBOM::CycloneDX::CryptoProperties::AlgorithmProperties->new( %PARAMS ) | ||||||||||
| 96 | |||||||||||
| 97 | Properties: | ||||||||||
| 98 | |||||||||||
| 99 | =over | ||||||||||
| 100 | |||||||||||
| 101 | =item * C<algorithm_family>, A valid algorithm family identifier. If specified, | ||||||||||
| 102 | this value must be one of the enumeration of valid algorithm Family identifiers | ||||||||||
| 103 | defined in the C<cryptography-defs.schema.json> subschema. | ||||||||||
| 104 | |||||||||||
| 105 | =item * C<certification_level>, The certification that the implementation of | ||||||||||
| 106 | the cryptographic algorithm has received, if any. Certifications include | ||||||||||
| 107 | revisions and levels of FIPS 140 or Common Criteria of different Extended | ||||||||||
| 108 | Assurance Levels (CC-EAL). | ||||||||||
| 109 | |||||||||||
| 110 | =item * C<classical_security_level>, The classical security level that a | ||||||||||
| 111 | cryptographic algorithm provides (in bits). | ||||||||||
| 112 | |||||||||||
| 113 | =item * C<crypto_functions>, The cryptographic functions implemented by the | ||||||||||
| 114 | cryptographic algorithm. | ||||||||||
| 115 | |||||||||||
| 116 | =item * C<curve>, [Deprecated] The specific underlying Elliptic Curve (EC) definition | ||||||||||
| 117 | employed which is an indicator of the level of security strength, | ||||||||||
| 118 | performance and complexity. Absent an authoritative source of curve names, | ||||||||||
| 119 | CycloneDX recommends using curve names as defined at | ||||||||||
| 120 | L<https://neuromancer.sk/std/>, the source of | ||||||||||
| 121 | which can be found at L<https://github.com/J08nY/std-curves>. | ||||||||||
| 122 | |||||||||||
| 123 | =item * C<execution_environment>, The target and execution environment in | ||||||||||
| 124 | which the algorithm is implemented in. | ||||||||||
| 125 | |||||||||||
| 126 | =item * C<implementation_platform>, The target platform for which the | ||||||||||
| 127 | algorithm is implemented. The implementation can be 'generic', running on | ||||||||||
| 128 | any platform or for a specific platform. | ||||||||||
| 129 | |||||||||||
| 130 | =item * C<mode>, The mode of operation in which the cryptographic algorithm | ||||||||||
| 131 | (block cipher) is used. | ||||||||||
| 132 | |||||||||||
| 133 | =item * C<nist_quantum_security_level>, The NIST security strength category | ||||||||||
| 134 | as defined in | ||||||||||
| 135 | L<https://csrc.nist.gov/projects/post-quantum-cryptography/post-quantum-crypt | ||||||||||
| 136 | ography-standardization/evaluation-criteria/security-(evaluation-criteria)>. | ||||||||||
| 137 | A value of 0 indicates that none of the categories are met. | ||||||||||
| 138 | |||||||||||
| 139 | =item * C<padding>, The padding scheme that is used for the cryptographic | ||||||||||
| 140 | algorithm. | ||||||||||
| 141 | |||||||||||
| 142 | =item * C<parameter_set_identifier>, An identifier for the parameter set of | ||||||||||
| 143 | the cryptographic algorithm. Examples: in AES128, '128' identifies the key | ||||||||||
| 144 | length in bits, in SHA256, '256' identifies the digest length, '128' in | ||||||||||
| 145 | SHAKE128 identifies its maximum security level in bits, and 'SHA2-128s' | ||||||||||
| 146 | identifies a parameter set used in SLH-DSA (FIPS205). | ||||||||||
| 147 | |||||||||||
| 148 | =item * C<primitive>, Cryptographic building blocks used in higher-level | ||||||||||
| 149 | cryptographic systems and protocols. Primitives represent different | ||||||||||
| 150 | cryptographic routines: deterministic random bit generators (drbg, e.g. | ||||||||||
| 151 | CTR_DRBG from NIST SP800-90A-r1), message authentication codes (mac, e.g. | ||||||||||
| 152 | HMAC-SHA-256), blockciphers (e.g. AES), streamciphers (e.g. Salsa20), | ||||||||||
| 153 | signatures (e.g. ECDSA), hash functions (e.g. SHA-256), public-key | ||||||||||
| 154 | encryption schemes (pke, e.g. RSA), extended output functions (xof, e.g. | ||||||||||
| 155 | SHAKE256), key derivation functions (e.g. pbkdf2), key agreement algorithms | ||||||||||
| 156 | (e.g. ECDH), key encapsulation mechanisms (e.g. ML-KEM), authenticated | ||||||||||
| 157 | encryption (ae, e.g. AES-GCM) and the combination of multiple algorithms | ||||||||||
| 158 | (combiner, e.g. SP800-56Cr2). | ||||||||||
| 159 | |||||||||||
| 160 | =back | ||||||||||
| 161 | |||||||||||
| 162 | =item $algorithm_properties->algorithm_family | ||||||||||
| 163 | |||||||||||
| 164 | =item $algorithm_properties->certification_level | ||||||||||
| 165 | |||||||||||
| 166 | =item $algorithm_properties->classical_security_level | ||||||||||
| 167 | |||||||||||
| 168 | =item $algorithm_properties->crypto_functions | ||||||||||
| 169 | |||||||||||
| 170 | =item $algorithm_properties->curve | ||||||||||
| 171 | |||||||||||
| 172 | =item $algorithm_properties->execution_environment | ||||||||||
| 173 | |||||||||||
| 174 | =item $algorithm_properties->implementation_platform | ||||||||||
| 175 | |||||||||||
| 176 | =item $algorithm_properties->mode | ||||||||||
| 177 | |||||||||||
| 178 | =item $algorithm_properties->nist_quantum_security_level | ||||||||||
| 179 | |||||||||||
| 180 | =item $algorithm_properties->padding | ||||||||||
| 181 | |||||||||||
| 182 | =item $algorithm_properties->parameter_set_identifier | ||||||||||
| 183 | |||||||||||
| 184 | =item $algorithm_properties->primitive | ||||||||||
| 185 | |||||||||||
| 186 | =back | ||||||||||
| 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<https://github.com/giterlizzi/perl-SBOM-CycloneDX/issues>. | ||||||||||
| 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<https://github.com/giterlizzi/perl-SBOM-CycloneDX> | ||||||||||
| 202 | |||||||||||
| 203 | git clone https://github.com/giterlizzi/perl-SBOM-CycloneDX.git | ||||||||||
| 204 | |||||||||||
| 205 | |||||||||||
| 206 | =head1 AUTHOR | ||||||||||
| 207 | |||||||||||
| 208 | =over 4 | ||||||||||
| 209 | |||||||||||
| 210 | =item * Giuseppe Di Terlizzi <gdt@cpan.org> | ||||||||||
| 211 | |||||||||||
| 212 | =back | ||||||||||
| 213 | |||||||||||
| 214 | |||||||||||
| 215 | =head1 LICENSE AND COPYRIGHT | ||||||||||
| 216 | |||||||||||
| 217 | This software is copyright (c) 2025-2026 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 | ||||||||||