lib/Crypt/Perl/RSA/PublicKey.pm

filter: Statementstmt 100% 18 / 18 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 100% 24 / 24 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« lib/Crypt/Perl/PKCS10/Attribute/extensionRequest.pm ↑ Summary lib/Crypt/Perl/X/Generic.pm »
1 package Crypt::Perl::RSA::PublicKey;
2  
3 =encoding utf-8
4  
5 =head1 NAME
6  
7 Crypt::Perl::RSA::PublicKey - object representation of an RSA public key
8  
9 =head1 SYNOPSIS
10  
11 #You’ll probably instantiate this class using Parser.pm
12 #or PrivateKey’s get_public_key() method.
13  
14 #cf. JSON Web Algorithms (RFC 7518, page 5)
15 #These return 1 or 0 to indicate verification or non-verification.
16 $pbkey->verify_RS256($message, $sig);
17 $pbkey->verify_RS384($message, $sig);
18 $pbkey->verify_RS512($message, $sig);
19  
20 #----------------------------------------------------------------------
21  
22 my $enc = $pbkey->encrypt_raw($payload);
23  
24 #----------------------------------------------------------------------
25  
26 my $der = $pbkey->to_der();
27 my $pem = $pbkey->to_pem();
28  
29 #For use in creating PKCS #10 CSRs and X.509 certificates
30 my $pub_der = $pbkey->to_subject_der();
31  
32 #----------------------------------------------------------------------
33  
34 $pbkey->size(); #modulus length, in bits
35 $pbkey->modulus_byte_length();
36  
37 #----------------------------------------------------------------------
38 # The following all return instances of Crypt::Perl::BigInt,
39 # a subclass of Math::BigInt.
40 # The pairs (e.g., modulus() and N()) are aliases.
41 #----------------------------------------------------------------------
42  
43 $pbkey->modulus();
44 $pbkey->N();
45  
46 $pbkey->publicExponent();
47 $pbkey->E();
48 $pbkey->exponent(); #another alias of publicExponent()
49  
50 =cut
51  
52 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
53 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
54  
55 5 use parent qw(
56 Crypt::Perl::RSA::KeyBase
57 5 ▶);
Subroutine BEGIN: called CC=1 SCAR=0.0
58  
59 5 ▶use constant _PEM_HEADER => 'RSA PUBLIC KEY';
Subroutine BEGIN: called CC=1 SCAR=0.0
60 5 ▶use constant _ASN1_MACRO => 'RSAPublicKey';
Subroutine BEGIN: called CC=1 SCAR=0.0
61  
62 BEGIN {
63 5 ▶ *exponent = __PACKAGE__->can('publicExponent');
Subroutine BEGIN: called CC=1 SCAR=0.0
64 5 *to_subject_der = __PACKAGE__->can('_to_subject_public_der');
65 }
66  
67 5 1;
« lib/Crypt/Perl/PKCS10/Attribute/extensionRequest.pm ↑ Summary lib/Crypt/Perl/X/Generic.pm »