NAME

Crypt::PBE::PBES1 - Perl extension for PKCS #5 Password-Based Encryption Schema 1 (PBES1)

SYNOPSIS

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

DESCRIPTION

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.

CONSTRUCTOR

Crypt::PBE::PBES1->new ( %params )

Params:

  • password : The password to use for the derivation

  • hash : Hash algorithm ("md2", "md5 or "sha1")

  • encryption : Encryption method ("des")

  • count : The number of internal iteractions to perform for the derivation key (default "1_000")

METHODS

$pbes1->encrypt( $message )

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');

$pbes1->decrypt( $data )

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);

SUPPORT

Bugs / Feature Requests

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.

Source Code

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

AUTHOR

  • Giuseppe Di Terlizzi <gdt@cpan.org>

SEE ALSO

Crypt::PBE::PBKDF1
Crypt::PBE::PBES2
[RFC2898] PKCS #5: Password-Based Cryptography Specification Version 2.0 (https://tools.ietf.org/html/rfc2898)
[RFC8018] PKCS #5: Password-Based Cryptography Specification Version 2.1 (https://tools.ietf.org/html/rfc8018)

LICENSE AND COPYRIGHT

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.