| 1 | package Crypt::OpenPGP::Key::Secret::RSA; | ||||||||||||||||||||
| 2 | 2 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 3 | 2 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | 2 | our $VERSION = '1.21'; # VERSION | |||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 2 | ▶ | use Crypt::RSA::Key::Private; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | 2 | ▶ | use Crypt::OpenPGP::Key::Public::RSA; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | 2 | ▶ | use Crypt::OpenPGP::Util qw( bin2mp ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | 2 | ▶ | use parent qw( Crypt::OpenPGP::Key::Secret Crypt::OpenPGP::ErrorHandler ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 11 | |||||||||||||||||||||
| 12 | 5 | ▶ | sub secret_props { qw( d p q u ) } | ||||||||||||||||||
|
Subroutine
secret_props: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 13 | 2 | *sig_props = \&Crypt::OpenPGP::Key::Public::RSA::sig_props; | |||||||||||||||||||
| 14 | 2 | *public_props = \&Crypt::OpenPGP::Key::Public::RSA::public_props; | |||||||||||||||||||
| 15 | 2 | *crypt_props = \&Crypt::OpenPGP::Key::Public::RSA::crypt_props; | |||||||||||||||||||
| 16 | 2 | *size = \&Crypt::OpenPGP::Key::Public::RSA::size; | |||||||||||||||||||
| 17 | 2 | *encode = \&Crypt::OpenPGP::Key::Public::RSA::encode; | |||||||||||||||||||
| 18 | 2 | *keygen = \&Crypt::OpenPGP::Key::Public::RSA::keygen; | |||||||||||||||||||
| 19 | 2 | *can_encrypt = \&Crypt::OpenPGP::Key::Public::RSA::can_encrypt; | |||||||||||||||||||
| 20 | 2 | *can_sign = \&Crypt::OpenPGP::Key::Public::RSA::can_sign; | |||||||||||||||||||
| 21 | |||||||||||||||||||||
| 22 | 3 | ▶ | sub init { | ||||||||||||||||||
|
Subroutine
init: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||
| 23 | 3 | my $key = shift; | |||||||||||||||||||
| 24 | $key->{key_data} = shift || | ||||||||||||||||||||
| 25 | 3 | ▶ | Crypt::RSA::Key::Private->new( Password => 'pgp' ); | ||||||||||||||||||
|
Condition66%2/3
shift() || 'Crypt::RSA::Key::Private'->new('Password', 'pgp')
MC/DC0%0/2
shift() || 'Crypt::RSA::Key::Private'->new('Password', 'pgp')
shift()
'Crypt::RSA::Key::Private'->new('Password', 'pgp')
Truth table66%2/3
A || B
A= shift()B= 'Crypt::RSA::Key::Private'->new('Password', 'pgp')
| |||||||||||||||||||||
| 26 | 3 | $key; | |||||||||||||||||||
| 27 | } | ||||||||||||||||||||
| 28 | |||||||||||||||||||||
| 29 | 2 | *encrypt = \&Crypt::OpenPGP::Key::Public::RSA::encrypt; | |||||||||||||||||||
| 30 | |||||||||||||||||||||
| 31 | 0 | ▶ | sub decrypt { | ||||||||||||||||||
|
Subroutine
decrypt: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 32 | 0 | my $key = shift; | |||||||||||||||||||
| 33 | 0 | my($C) = @_; | |||||||||||||||||||
| 34 | 0 | require Crypt::RSA::Primitives; | |||||||||||||||||||
| 35 | 0 | my $prim = Crypt::RSA::Primitives->new; | |||||||||||||||||||
| 36 | 0 | $prim->core_decrypt( Key => $key->{key_data}, Cyphertext => $C->{c} ); | |||||||||||||||||||
| 37 | } | ||||||||||||||||||||
| 38 | |||||||||||||||||||||
| 39 | 1 | ▶ | sub sign { | ||||||||||||||||||
|
Subroutine
sign: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 40 | 1 | my $key = shift; | |||||||||||||||||||
| 41 | 1 | my($dgst, $hash_alg) = @_; | |||||||||||||||||||
| 42 | 1 | my $m = encode($dgst, $hash_alg, $key->bytesize - 1); | |||||||||||||||||||
| 43 | 1 | require Crypt::RSA::Primitives; | |||||||||||||||||||
| 44 | 1 | my $prim = Crypt::RSA::Primitives->new; | |||||||||||||||||||
| 45 | 1 | $m = bin2mp($m); | |||||||||||||||||||
| 46 | 1 | my $c = $prim->core_sign( Key => $key->{key_data}, Message => $m ); | |||||||||||||||||||
| 47 | 1 | { c => $c } | |||||||||||||||||||
| 48 | } | ||||||||||||||||||||
| 49 | |||||||||||||||||||||
| 50 | 2 | 1; | |||||||||||||||||||