« blib/lib/Crypt/Perl/Ed25519/Parse.pm
↑ Summary
blib/lib/Crypt/Perl/X509/Extension/nameConstraints.pm »
| 1 | package Crypt::Perl::ECDSA::NIST; | ||||||||||
| 2 | |||||||||||
| 3 | 7 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 7 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 7 | ▶ | use Symbol::Get (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 7 | ▶ | use Crypt::Perl::X (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 7 | ▶ | use constant JWK_CURVE_prime256v1 => 'P-256'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 7 | ▶ | use constant JWK_CURVE_secp384r1 => 'P-384'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 7 | ▶ | use constant JWK_CURVE_secp521r1 => 'P-521'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | |||||||||||
| 14 | sub get_nist_for_curve_name { | ||||||||||
| 15 | 5 | ▶ | my ($curve_name) = @_; | ||||||||
|
Subroutine
get_nist_for_curve_name: called CC=3 SCAR=12.0
Pod
undocumented
| |||||||||||
| 16 | |||||||||||
| 17 | 5 | ▶ | die Crypt::Perl::X::create('Generic', 'Need curve name!') if !length $curve_name; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 18 | |||||||||||
| 19 | 5 | ▶ | my $cr = __PACKAGE__->can("JWK_CURVE_$curve_name") or do { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 20 | 0 | die Crypt::Perl::X::create('ECDSA::NoCurveForName', { name => $curve_name }); | |||||||||
| 21 | }; | ||||||||||
| 22 | |||||||||||
| 23 | 5 | return $cr->(); | |||||||||
| 24 | } | ||||||||||
| 25 | |||||||||||
| 26 | sub get_curve_name_for_nist { | ||||||||||
| 27 | 4 | ▶ | my ($nist_name) = @_; | ||||||||
|
Subroutine
get_curve_name_for_nist: called CC=5 SCAR=16.3
Pod
undocumented
| |||||||||||
| 28 | |||||||||||
| 29 | 4 | ▶ | die Crypt::Perl::X::create('Generic', 'Need NIST curve name!') if !length $nist_name; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 30 | |||||||||||
| 31 | 4 | for my $node ( Symbol::Get::get_names() ) { | |||||||||
| 32 | 14 | ▶ | next if $node !~ m<\AJWK_CURVE_(.+)>; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 33 | |||||||||||
| 34 | 8 | my $nist = __PACKAGE__->can($node)->(); | |||||||||
| 35 | 8 | ▶ | return $1 if $nist eq $nist_name; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | } | ||||||||||
| 37 | |||||||||||
| 38 | 0 | die Crypt::Perl::X::create('ECDSA::NoCurveForNISTName', { name => $nist_name }); | |||||||||
| 39 | } | ||||||||||
| 40 | |||||||||||
| 41 | 7 | 1; | |||||||||