Passing/Role/Crypt/CBC.pm

filter: Statementstmt 77.7% 7 / 9 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 83.3% 10 / 12 SCAR 0.1
CC
1
Cov
78%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Passing/Filter/Decoder/Crypt/CBC.pm ↑ Summary Passing/Output/Test.pm »
1 package Message::Passing::Role::Crypt::CBC;
2 1 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use MooX::Types::MooseLike::Base qw/ Str /;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Crypt::CBC;
Subroutine BEGIN: called CC=1 SCAR=2.6
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  
« Passing/Filter/Decoder/Crypt/CBC.pm ↑ Summary Passing/Output/Test.pm »