#!/usr/bin/perl

use strict;
use warnings;
use utf8;

use Crypt::PBE::CLI;

Crypt::PBE::CLI->run( \@ARGV, \*ARGV ) unless caller();

=encoding utf-8

=head1 NAME

pkcs5-tool - PKCS#5 Password-Based Encryption Tools

=head1 SYNOPSIS

    pkcs5-tool [OPTIONS]

    Options:
          --help                Brief help message
          --man                 Full documentation
          --version             Print version
      -v, --verbose             Verbose

          --algorithm           PBE algorithm
          --list-algorithms     List PBE algorithms

      -0, --null                Return NULL char instead of new line

          --password            Password
          --input               Input data
        
          --encrypt             Encrypt some data
          --decrypt             Decrypt some data

          --format=FORMAT       input/output format (base64 or hex)
          --base64              Base64 input/output format
          --hex                 HEX input/output format

    Examples:

        Encrypt:

            pkcs5-tool --algorithm PBEWithHmacSHA1AndAES_128 --password mypassword --input secret --encrypt

        Decrypt:

            pkcs5-tool --algorithm PBEWithHmacSHA1AndAES_128 --password mypassword --input <Base64 encrypted data> --decrypt

        Read input from STDIN:

            echo -n "secret" | pkcs5-tool --algorithm PBEWithHmacSHA1AndAES_128 --password mypassword --encrypt
            pkcs5-tool --algorithm PBEWithHmacSHA1AndAES_128 --password mypassword --encrypt < /path/of/secret

        env: or file: prefix for --password and --input params:

            pkcs5-tool --algorithm PBEWithHmacSHA1AndAES_128 --password env:APP_PASSWORD --input secret --encrypt > /path/data.enc
            pkcs5-tool --algorithm PBEWithHmacSHA1AndAES_128 --password env:APP_PASSWORD --input file:/path/data.enc --decrypt


=head1 DESCRIPTION

C<pkcs5-tool> PKCS#5 Password-Based Encryption Tools

=head1 AUTHOR

L<Giuseppe Di Terlizzi|https://metacpan.org/author/gdt>

=head1 COPYRIGHT AND LICENSE

Copyright © 2020-2021 L<Giuseppe Di Terlizzi|https://metacpan.org/author/gdt>

You may use and distribute this module according to the same terms
that Perl is distributed under.
