package Message::Passing::Role::Crypt::CBC; use Moo::Role; use MooX::Types::MooseLike::Base qw/ Str /; use Crypt::CBC; use namespace::clean -except => 'meta'; foreach my $name (qw/ encryption_key encryption_cipher /) { has $name => ( isa => Str, is => 'ro', required => 1, ); } # NOTE - We need a new CBC object per message, otherwise if we _EVER_ drop # messages then we totally screw ourselves! sub cbc { my $self = shift; Crypt::CBC->new( -key => $self->encryption_key, -cipher => $self->encryption_cipher, ); } 1; =head1 NAME Message::Passing::Role::Crypt::CBC - Common attributes for encoding or decoding encrypted messages =head1 ATTRIBUTES =head2 encryption_key The key for encryption (this is a shared secret key between both sides) =head2 encryption_cipher Any cipher supported by L. =head1 METHODS =head2 cbc Returns a new L object. =head1 SEE ALSO =over =item L =item L =item L =back =head1 AUTHOR, COPYRIGHT & LICENSE See L. =cut