openssl pbkdf2 and perl

59 Views Asked by At

I have created some perl scripts to encrypt and decrypt documents. I do this successfully using openssl 3.0.2. I use openssl enc and -pbkdf2 for greater security keeping my 'password' separate from the encoded data. Unfortunately, I don't have access to linux wherever I am so have tried to use perl module Crypt::CBC but only to decrypt what I have already encrypted with openssl (as I can use Strawberry perl on a MS machine). I want to know if this is even possible, given I don't know exactly how openssl has derived key, vi, salt etc from the plain text password. I keep getting error:

The key must be 128, 192 or 256 bits long at /usr/local/share/perl/5.34.0/Crypt/CBC.pm line 692.

The cipher I am using is aes-256-cbc. This is probably a stupid question (but I am a newb at this).

I expected that, having the password/passphrase used to encrypt, I would be able to decrypt. I am using:

$cipher = Crypt::CBC->new(
     -key    => $password,
     -cipher => "Crypt::OpenSSL::AES",
     -pbkdf  => 'pbkdf2',
);
0

There are 0 best solutions below