line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Message::Passing::Role::Crypt::CBC; |
2
|
1
|
|
|
1
|
|
584
|
use Moo::Role; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
3
|
1
|
|
|
1
|
|
894
|
use MooX::Types::MooseLike::Base qw/ Str /; |
|
1
|
|
|
|
|
6997
|
|
|
1
|
|
|
|
|
74
|
|
4
|
1
|
|
|
1
|
|
337
|
use Crypt::CBC; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
use namespace::clean -except => 'meta'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
foreach my $name (qw/ |
8
|
|
|
|
|
|
|
encryption_key |
9
|
|
|
|
|
|
|
encryption_cipher |
10
|
|
|
|
|
|
|
/) { |
11
|
|
|
|
|
|
|
has $name => ( |
12
|
|
|
|
|
|
|
isa => Str, |
13
|
|
|
|
|
|
|
is => 'ro', |
14
|
|
|
|
|
|
|
required => 1, |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# NOTE - We need a new CBC object per message, otherwise if we _EVER_ drop |
19
|
|
|
|
|
|
|
# messages then we totally screw ourselves! |
20
|
|
|
|
|
|
|
sub cbc { |
21
|
|
|
|
|
|
|
my $self = shift; |
22
|
|
|
|
|
|
|
Crypt::CBC->new( |
23
|
|
|
|
|
|
|
-key => $self->encryption_key, |
24
|
|
|
|
|
|
|
-cipher => $self->encryption_cipher, |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
1; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 NAME |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
Message::Passing::Role::Crypt::CBC - Common attributes for encoding or decoding encrypted messages |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head2 encryption_key |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
The key for encryption (this is a shared secret key between both sides) |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head2 encryption_cipher |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
Any cipher supported by L<Crypt::CBC>. |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 METHODS |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head2 cbc |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Returns a new L<Crypt::CBC> object. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 SEE ALSO |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=over |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=item L<Message::Passing::Filter::Encoder::Crypt::CBC> |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=item L<Message::Passing::Filter::Decoder::Crypt::CBC> |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=item L<Crypt::CBC> |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=back |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 AUTHOR, COPYRIGHT & LICENSE |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
See L<Message::Passing>. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=cut |
67
|
|
|
|
|
|
|
|