| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
1
|
|
|
1
|
|
19517
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
27
|
|
|
2
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
51
|
|
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Tiny::OpenSSL::PKCS12; |
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# ABSTRACT: Tiny::OpenSSL::PKCS12 Object |
|
7
|
|
|
|
|
|
|
our $VERSION = '0.1.3'; # VERSION |
|
8
|
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
746
|
use Moo; |
|
|
1
|
|
|
|
|
14561
|
|
|
|
1
|
|
|
|
|
7
|
|
|
10
|
1
|
|
|
1
|
|
1597
|
use Carp; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
74
|
|
|
11
|
1
|
|
|
1
|
|
798
|
use Types::Standard qw( Str InstanceOf ); |
|
|
1
|
|
|
|
|
72875
|
|
|
|
1
|
|
|
|
|
17
|
|
|
12
|
1
|
|
|
1
|
|
1814
|
use Capture::Tiny qw( :all ); |
|
|
1
|
|
|
|
|
28751
|
|
|
|
1
|
|
|
|
|
158
|
|
|
13
|
1
|
|
|
1
|
|
522
|
use Tiny::OpenSSL::Config qw($CONFIG); |
|
|
1
|
|
|
|
|
4
|
|
|
|
1
|
|
|
|
|
436
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
with 'Tiny::OpenSSL::Role::Entity'; |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has certificate => ( |
|
18
|
|
|
|
|
|
|
is => 'rw', |
|
19
|
|
|
|
|
|
|
isa => InstanceOf ['Tiny::OpenSSL::Certificate'], |
|
20
|
|
|
|
|
|
|
required => 1 |
|
21
|
|
|
|
|
|
|
); |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
has key => ( |
|
24
|
|
|
|
|
|
|
is => 'rw', |
|
25
|
|
|
|
|
|
|
isa => InstanceOf ['Tiny::OpenSSL::Key'], |
|
26
|
|
|
|
|
|
|
required => 1 |
|
27
|
|
|
|
|
|
|
); |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
has identity => ( |
|
30
|
|
|
|
|
|
|
is => 'rw', |
|
31
|
|
|
|
|
|
|
isa => Str, |
|
32
|
|
|
|
|
|
|
required => 1 |
|
33
|
|
|
|
|
|
|
); |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
has passphrase => ( |
|
36
|
|
|
|
|
|
|
is => 'rw', |
|
37
|
|
|
|
|
|
|
isa => Str, |
|
38
|
|
|
|
|
|
|
required => 1 |
|
39
|
|
|
|
|
|
|
); |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub create { |
|
43
|
1
|
|
|
1
|
1
|
1929
|
my $self = shift; |
|
44
|
|
|
|
|
|
|
|
|
45
|
1
|
|
|
|
|
5
|
my $pass_file = Path::Tiny->tempfile; |
|
46
|
1
|
|
|
|
|
470
|
$pass_file->spew( $self->passphrase ); |
|
47
|
|
|
|
|
|
|
|
|
48
|
1
|
|
|
|
|
1215
|
my @args = ( |
|
49
|
|
|
|
|
|
|
'pkcs12', '-export', |
|
50
|
|
|
|
|
|
|
'-in', $self->certificate->file, |
|
51
|
|
|
|
|
|
|
'-inkey', $self->key->file, |
|
52
|
|
|
|
|
|
|
'-name', $self->identity, |
|
53
|
|
|
|
|
|
|
'-out', $self->file, |
|
54
|
|
|
|
|
|
|
'-passout', sprintf( 'file:%s', $pass_file ) |
|
55
|
|
|
|
|
|
|
); |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
my ( $stdout, $stderr, $exit ) = capture { |
|
58
|
1
|
|
|
1
|
|
23955
|
system( $CONFIG->{openssl}, @args ); |
|
59
|
1
|
|
|
|
|
1978
|
}; |
|
60
|
|
|
|
|
|
|
|
|
61
|
1
|
50
|
|
|
|
1135
|
if ( $exit != 0 ) { |
|
62
|
0
|
|
|
|
|
0
|
croak( sprintf( 'cannot create pkcs12 file: %s', $stderr ) ); |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
1
|
|
|
|
|
26
|
return 1; |
|
66
|
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
__END__ |