1 package File
::KDBX
::Cipher
::CBC
;
2 # ABSTRACT: A CBC block cipher mode encrypter/decrypter
11 use parent
'File::KDBX::Cipher';
13 our $VERSION = '999.999'; # VERSION
18 my $mode = $self->{mode
} ||= do {
19 my $m = Crypt
::Mode
::CBC-
>new($self->algorithm);
20 $m->start_encrypt($self->key, $self->iv);
24 return join('', map { $mode->add(ref $_ ? $$_ : $_) } grep { defined } @_);
30 my $mode = $self->{mode
} ||= do {
31 my $m = Crypt
::Mode
::CBC-
>new($self->algorithm);
32 $m->start_decrypt($self->key, $self->iv);
36 return join('', map { $mode->add(ref $_ ? $$_ : $_) } grep { defined } @_);
41 return '' if !$self->{mode
};
42 my $out = $self->{mode
}->finish;
49 Get the symmetric cipher algorithm
.
53 sub algorithm
{ $_[0]->{algorithm
} or throw
'Block cipher algorithm is not set' }
54 sub key_size
{ $_[0]->{key_size
} // 32 }
63 use File::KDBX::Cipher::CBC;
65 my $cipher = File::KDBX::Cipher::CBC->new(algorithm => $algo, key => $key, iv => $iv);
69 A subclass of L<File::KDBX::Cipher> for encrypting and decrypting data using the CBC block cipher mode.