| 1 | package Proxy::Impersonate::Cert; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 3 | ▶ | use v5.10; use strict; use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 3 | ▶ | use Carp (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 3 | ▶ | use Fcntl qw(O_CREAT O_WRONLY O_EXCL); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 3 | ▶ | use Net::SSLeay (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 3 | ▶ | BEGIN { Net::SSLeay::initialize() } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | # A single persisted self-signed server cert, presented for every host. Under | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | # the WebKit set_tls_errors_policy(IGNORE) trust model (see the design's | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | # post-spike revision), WebKit accepts it regardless of host, so no CA and no | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | # per-host minting are needed. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 12 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=6 SCAR=18.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 12 | my ($class, %o) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 12 | ▶ | my $dir = $o{cert_dir} or Carp::croak('Cert: cert_dir required'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 12 | ▶ | -d $dir or mkdir $dir, 0700 or Carp::croak("Cert: mkdir $dir: $!"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
-d $dir or mkdir $dir, 448
MC/DC0%0/2
-d $dir or mkdir $dir, 448
-d $dir
mkdir $dir, 448
Truth table33%1/3
A or B
A= -d $dirB= mkdir $dir, 448
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 12 | my $self = bless { dir => $dir }, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 12 | $self->_load_or_generate; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 8 | ▶ | my $ctx = Net::SSLeay::CTX_new() or Carp::croak('Cert: CTX_new failed'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 8 | my $ok = eval { $self->apply_to_ctx($ctx); 1 }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 8 | my $err = $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 8 | Net::SSLeay::CTX_free($ctx); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 8 | ▶ | Carp::croak($err) unless $ok; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 7 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 15 | ▶ | sub cert_path { "$_[0]{dir}/cert.pem" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cert_path: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 21 | ▶ | sub key_path { "$_[0]{dir}/key.pem" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
key_path: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 3 | ▶ | sub cert { $_[0]{cert} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cert: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 2 | ▶ | sub key { $_[0]{key} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
key: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 5 | ▶ | sub _gen_key { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_gen_key: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 5 | my $rsa = Net::SSLeay::RSA_generate_key(2048, 0x10001); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 5 | my $pk = Net::SSLeay::EVP_PKEY_new(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 5 | Net::SSLeay::EVP_PKEY_assign_RSA($pk, $rsa); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 5 | return $pk; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 5 | ▶ | sub _mk_self_signed { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mk_self_signed: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 5 | my ($cn, $pkey, $san) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 5 | my $x = Net::SSLeay::X509_new(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 5 | Net::SSLeay::X509_set_version($x, 2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 5 | Net::SSLeay::ASN1_INTEGER_set(Net::SSLeay::X509_get_serialNumber($x), (int(rand(2**31)) | 1)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 5 | Net::SSLeay::X509_gmtime_adj(Net::SSLeay::X509_get_notBefore($x), -3600); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 5 | Net::SSLeay::X509_gmtime_adj(Net::SSLeay::X509_get_notAfter($x), 60*60*24*3650); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 5 | Net::SSLeay::X509_set_pubkey($x, $pkey); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 5 | Net::SSLeay::X509_NAME_add_entry_by_txt( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | Net::SSLeay::X509_get_subject_name($x), 'CN', &Net::SSLeay::MBSTRING_UTF8, $cn, -1, 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 5 | Net::SSLeay::X509_set_issuer_name($x, Net::SSLeay::X509_get_subject_name($x)); # self | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 5 | Net::SSLeay::P_X509_add_extensions($x, $x, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | &Net::SSLeay::NID_basic_constraints => 'CA:FALSE', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | &Net::SSLeay::NID_subject_alt_name => $san, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | &Net::SSLeay::NID_key_usage => 'digitalSignature,keyEncipherment', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | &Net::SSLeay::NID_ext_key_usage => 'serverAuth'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 5 | Net::SSLeay::X509_sign($x, $pkey, Net::SSLeay::EVP_sha256()); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 5 | return $x; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 12 | ▶ | sub _load_or_generate { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_load_or_generate: called CC=16 SCAR=28.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 12 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 12 | my ($cf, $kf) = ($self->cert_path, $self->key_path); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 12 | ▶ | if (-e $cf || -l $cf || -e $kf || -l $kf) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%6/9
-e $cf or -l $cf or -e $kf or -l $kf
-e $cf or -l $cf or -e $kf
-e $cf or -l $cf
MC/DC25%1/4
-e $cf or -l $cf or -e $kf or -l $kf
-e $cf
-l $cf
-e $kf
-l $kf
Truth table40%2/5
A or B or C or D
A= -e $cfB= -l $cfC= -e $kfD= -l $kf
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 7 | ▶ | Carp::croak('Cert: incomplete certificate/key pair') unless -r $cf && -r $kf; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
-r $cf and -r $kf
MC/DC50%1/2
-r $cf and -r $kf
-r $cf
-r $kf
Truth table66%2/3
A and B
A= -r $cfB= -r $kf
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | # Adopting a key we did not write is the interesting case: cert_dir is a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | # 0700 File::Temp dir by default, but the option exists precisely so a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | # caller can persist the cert somewhere of their choosing -- and a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | # shared location is where this goes wrong. A key that is group- or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | # world-accessible, or owned by somebody else, means whoever put it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | # there can impersonate this proxy to the browser it fronts (which is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | # configured to accept its certificate). Refuse rather than adopt it. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | # Symlink-safe: lstat, so a symlink to a 0600 file is judged on the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | # LINK, and O_NOFOLLOW-equivalent semantics apply to the check. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 6 | my @st = lstat $kf; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 6 | ▶ | if (@st) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 6 | my ($mode, $uid) = @st[2, 4]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 6 | ▶ | Carp::croak("Cert: refusing to use $kf -- it is a symlink") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | if -l _; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 5 | ▶ | Carp::croak("Cert: refusing to use $kf -- not a regular file") unless -f _; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 5 | ▶ | Carp::croak(sprintf 'Cert: refusing to use %s -- mode %04o is accessible ' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | . 'beyond its owner (want 0600)', $kf, $mode & 07777) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | if $mode & 077; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 4 | ▶ | Carp::croak("Cert: refusing to use $kf -- it is owned by uid $uid, not $<") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | if $uid != $<; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 4 | ▶ | my $bc = Net::SSLeay::BIO_new_file($cf, 'r') or Carp::croak("Cert: read $cf failed"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 4 | $self->{cert} = Net::SSLeay::PEM_read_bio_X509($bc); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 4 | Net::SSLeay::BIO_free($bc); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 4 | ▶ | Carp::croak("Cert: invalid certificate in $cf") unless $self->{cert}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 3 | ▶ | my $bk = Net::SSLeay::BIO_new_file($kf, 'r') or Carp::croak("Cert: read $kf failed"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 3 | $self->{key} = Net::SSLeay::PEM_read_bio_PrivateKey($bk); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 3 | Net::SSLeay::BIO_free($bk); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 3 | ▶ | Carp::croak("Cert: invalid private key in $kf") unless $self->{key}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 3 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 5 | my $key = _gen_key(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 5 | my $cert = _mk_self_signed('Proxy::Impersonate', $key, 'DNS:localhost'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 5 | $self->{key} = $key; $self->{cert} = $cert; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 5 | _spew($cf, Net::SSLeay::PEM_get_string_X509($cert), 0644); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 5 | _spew($kf, Net::SSLeay::PEM_get_string_PrivateKey($key), 0600); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | # Use the validated in-memory pair for every handshake. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 12 | ▶ | sub apply_to_ctx { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
apply_to_ctx: called CC=4 SCAR=14.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 12 | my ($self, $ctx) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | Net::SSLeay::CTX_use_certificate($ctx, $self->{cert}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | && Net::SSLeay::CTX_use_PrivateKey($ctx, $self->{key}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 12 | ▶ | && Net::SSLeay::CTX_check_private_key($ctx) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
&Net::SSLeay::CTX_use_certificate($ctx, $self->{"cert"}) and &Net::SSLeay::CTX_use_PrivateKey($ctx, $self->{"key"}) and &Net::SSLeay::CTX_check_private_key($ctx)
&Net::SSLeay::CTX_use_certificate($ctx, $self->{"cert"}) and &Net::SSLeay::CTX_use_PrivateKey($ctx, $self->{"key"})
MC/DC33%1/3
&Net::SSLeay::CTX_use_certificate($ctx, $self->{"cert"}) and &Net::SSLeay::CTX_use_PrivateKey($ctx, $self->{"key"}) and &Net::SSLeay::CTX_check_private_key($ctx)
&Net::SSLeay::CTX_use_certificate($ctx, $self->{"cert"})
&Net::SSLeay::CTX_use_PrivateKey($ctx, $self->{"key"})
&Net::SSLeay::CTX_check_private_key($ctx)
Truth table50%2/4
A and B and C
A= &Net::SSLeay::CTX_use_certificate($ctx, $self->{"cert"})B= &Net::SSLeay::CTX_use_PrivateKey($ctx, $self->{"key"})C= &Net::SSLeay::CTX_check_private_key($ctx)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | or Carp::croak('Cert: invalid or mismatched certificate/key pair'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 10 | ▶ | sub _spew { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_spew: called CC=5 SCAR=19.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 10 | my ($path, $data, $mode) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 10 | ▶ | $mode //= 0644; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$mode //= 420
MC/DC0%0/1
$mode //= 420
$mode
Truth table50%1/2
A
A= $mode
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | # create at the target mode so the private key never exists world-readable | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | # in an open->chmod window | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 10 | ▶ | sysopen(my $fh, $path, O_CREAT | O_WRONLY | O_EXCL, $mode) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | or Carp::croak("Cert: write $path: $!"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 10 | my $ok = print $fh $data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 10 | ▶ | $ok = close($fh) && $ok; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
close $fh && $ok
MC/DC0%0/2
close $fh && $ok
close $fh
$ok
Truth table33%1/3
A && B
A= close $fhB= $ok
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 10 | ▶ | if (!$ok) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | my $err = $!; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | unlink $path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | Carp::croak("Cert: write $path: $err"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 12 | ▶ | sub DESTROY { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DESTROY: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 12 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 12 | ▶ | Net::SSLeay::X509_free($self->{cert}) if $self->{cert}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 12 | ▶ | Net::SSLeay::EVP_PKEY_free($self->{key}) if $self->{key}; # frees the assigned RSA too | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 3 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||