Crypt::PBE::PBES1 - Perl extension for PKCS #5 Password-Based Encryption Schema 1 (PBES1)
use Crypt::PBE::PBES1; my $pbes1 = Crypt::PBE::PBES1->new( 'hash' => 'md5', 'encryption' => 'des', 'password' => 'mypassword' ); my $encrypted = $pbes1->encrypt('secret'); say $pbes1->decrypt($encrypted); # secret
PBES1 combines the PBKDF1 function with an underlying block cipher, which shall be either DES or RC2 in cipher block chaining (CBC) mode.
PBES1 is recommended only for compatibility with existing applications, since it supports only two underlying encryption schemes, each of which has a key size (56 or 64 bits) that may not be large enough for some applications.
Params:
password : The password to use for the derivation
password
hash : Hash algorithm ("md2", "md5 or "sha1")
hash
encryption : Encryption method ("des")
encryption
count : The number of internal iteractions to perform for the derivation key (default "1_000")
count
Perform the encryption and return the encrypted message in binary format.
You can encode the encrypted message in Base64 using MIME::Base64:
$b64_encrypted = encode_base64 $pbes1->encrypt('secret');
Perform the decryption and return the original message.
$decrypted = $pbes1->decrypt($encrypted);
You can decode the Base64 encrypted message using MIME::Base64:
$decrypted = $pbes1->decrypt(decode_base64 $b64_encrypted);
Please report any bugs or feature requests through the issue tracker at https://github.com/giterlizzi/perl-Crypt-PBE/issues. You will be notified automatically of any progress on your issue.
This is open source software. The code repository is available for public review and contribution under the terms of the license.
https://github.com/giterlizzi/perl-Crypt-PBE
git clone https://github.com/giterlizzi/perl-Crypt-PBE.git
Giuseppe Di Terlizzi <gdt@cpan.org>
This software is copyright (c) 2020-2023 by Giuseppe Di Terlizzi.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Crypt::PBE, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Crypt::PBE
CPAN shell
perl -MCPAN -e shell install Crypt::PBE
For more information on module installation, please visit the detailed CPAN module installation guide.