Name

Class::Usul::Crypt::Util - Decrypts/Encrypts password from/to configuration files

Synopsis

use Class::Usul::Crypt::Util qw(decrypt_from_config);

$password = decrypt_from_config( $encrypted_value_from_file );

Description

Decrypts/Encrypts password from/to configuration files

Configuration and Environment

Implements a functional interface

Subroutines/Functions

decrypt_from_config

$plain_text = decrypt_from_config( $params, $password );

Strips the {Twofish2} prefix and then decrypts the password

encrypt_for_config

$encrypted_value = encrypt_for_config( $params, $plain_text );

Returns the encrypted value of the plain value prefixed with {Twofish2} for storage in a configuration file

get_cipher

$cipher = get_cipher( $encrypted_value );

Returns the name of the cipher used to encrypt the value

is_encrypted

$bool = is_encrypted( $password_or_encrypted_value );

Return true if the passed argument matches the pattern for an encrypted value

__extract_crypt_params

($cipher, $password) = __extract_crypt_params( $encrypted_value );

Extracts the cipher name and the encrypted password from the value stored in the configuration file. Returns the default cipher and null if the encrypted value does not match the proper pattern. The default cipher is specified by the default cipher function

__get_crypt_args

\%crypt_args = __get_crpyt_args( $params, $cipher );

Returns the argument hash ref passed to "encrypt" in Class::Usul::Crypt and "decrypt" in Class::Usul::Crypt

Diagnostics

None

Dependencies

Class::Usul
Try::Tiny
Exporter

Incompatibilities

There are no known incompatibilities in this module

Bugs and Limitations

There are no known bugs in this module. Please report problems to the address below. Patches are welcome

Acknowledgements

Larry Wall - For the Perl programming language

Author

Peter Flanigan, <pjfl@cpan.org>

License and Copyright

Copyright (c) 2014 Peter Flanigan. All rights reserved

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic

This program is distributed in the hope that it will be useful, but WITHOUT WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE