lib/Crypt/Perl/PKCS8.pm

filter: Statementstmt 100% 18 / 18 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 2 totaltotal 92.5% 25 / 27 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« lib/Crypt/Perl/ECDSA/PublicKey.pm ↑ Summary lib/Crypt/Perl/X/ASN1/Decode.pm »
1 package Crypt::Perl::PKCS8;
2  
3 #TODO: Rename this, and split up the public/private as appropriate.
4  
5 10 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 10 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 10 ▶use Crypt::Perl::ASN1 ();
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 10 ▶use constant ASN1 => <<END;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 -- FG: simplified from RFC for Convert::ASN1
12 Version ::= INTEGER
13  
14 -- cf. RFC 3280 4.1.1.2
15 AlgorithmIdentifier ::= SEQUENCE {
16 algorithm OBJECT IDENTIFIER,
17 parameters ANY DEFINED BY algorithm OPTIONAL
18 }
19  
20 -- cf. RFC 5208 appendix A
21 PrivateKeyInfo ::= SEQUENCE {
22 version Version,
23 privateKeyAlgorithm AlgorithmIdentifier,
24 privateKey PrivateKey
25 }
26  
27 PrivateKey ::= OCTET STRING
28  
29 -- cf. RFC 3280 4.1
30 SubjectPublicKeyInfo ::= SEQUENCE {
31 algorithm AlgorithmIdentifier,
32 subjectPublicKey BIT STRING
33 }
34 END
35  
36 sub parse_private {
37 1 ▶ my ($pem_or_der) = @_;
Subroutine parse_private: called CC=1 SCAR=0.0
Pod undocumented
38  
39 1 return _asn1()->find('PrivateKeyInfo')->decode($pem_or_der);
40 }
41  
42 sub parse_public {
43 1 ▶ my ($pem_or_der) = @_;
Subroutine parse_public: called CC=1 SCAR=0.0
Pod undocumented
44  
45 1 return _asn1()->find('SubjectPublicKeyInfo')->decode($pem_or_der);
46 }
47  
48 sub _asn1 {
49 2 ▶ return Crypt::Perl::ASN1->new()->prepare( Crypt::Perl::PKCS8::ASN1() );
Subroutine _asn1: called CC=1 SCAR=0.0
50 }
51  
52 10 1;
« lib/Crypt/Perl/ECDSA/PublicKey.pm ↑ Summary lib/Crypt/Perl/X/ASN1/Decode.pm »