diff options
author | Gianni Ceccarelli <gianni.ceccarelli@broadbean.com> | 2023-06-22 13:03:52 +0100 |
---|---|---|
committer | Gianni Ceccarelli <gianni.ceccarelli@broadbean.com> | 2023-06-22 13:03:52 +0100 |
commit | 677bc2677475ecd6dafe478cb580005affab3394 (patch) | |
tree | 78acdc4bc17d521e48c59fae7590efead7c86193 /lib/Config/ClawsMail/PasswordStore.pm | |
parent | pod the script (diff) | |
download | config-clawsmail-677bc2677475ecd6dafe478cb580005affab3394.tar.gz config-clawsmail-677bc2677475ecd6dafe478cb580005affab3394.tar.bz2 config-clawsmail-677bc2677475ecd6dafe478cb580005affab3394.zip |
fix padding
Diffstat (limited to 'lib/Config/ClawsMail/PasswordStore.pm')
-rw-r--r-- | lib/Config/ClawsMail/PasswordStore.pm | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Config/ClawsMail/PasswordStore.pm b/lib/Config/ClawsMail/PasswordStore.pm index 52a0a67..3fbb68f 100644 --- a/lib/Config/ClawsMail/PasswordStore.pm +++ b/lib/Config/ClawsMail/PasswordStore.pm @@ -38,7 +38,7 @@ sub decrypt($self,$input) { $rounds, 'SHA1', 32, # 32 bytes = 256 bits,for AES-256 ); - my $cipher = Crypt::Mode::CBC->new('AES', 0); # 0 = no padding + my $cipher = Crypt::Mode::CBC->new('AES', 5); # 5 = zero padding $ciphertext = decode_b64($ciphertext); @@ -49,7 +49,10 @@ sub decrypt($self,$input) { # the first 16 bytes are generated from the IV, we don't care # about them - return substr($cleartext,16); + $cleartext = substr($cleartext,16); + $cleartext =~ s/\0+\z//; + + return $cleartext; } sub password_for($self,$section,$key) { |