NAME

DBIx::Class::FilterColumn::Encrypt - Transparently encrypt columns in DBIx::Class

VERSION

version 0.002

SYNOPSIS

 __PACKAGE__->load_components(qw/FilterColumn::Encrypt/);

 __PACKAGE__->add_columns(
     id => {
         data_type         => 'integer',
         is_auto_increment => 1,
     },
     data => {
         data_type => 'text',
         encrypt   => {
			keys     => {
				0      => pack('H*', ...),
			},
		},
     },
 );

 __PACKAGE__->set_primary_key('id');


 # in application code
 $rs->create({ data => 'some secret' });

DESCRIPTION

This components transparently encrypts any value with the currently active key, or decrypts them with any known value. This is useful when needing read/write access to values that are too sensitive to store in plaintext, such as credentials for other services. For passwords you should be using DBIx::Class::CryptColumn instead of this module.

To enable encryption, encrypt must be a hash containing the key keys, which shall be a hash mapping numberic identifiers to keys. An optional argument active_key may be given which one will be used for encrypting, otherwise the key with the highest numeric value will be used automatically; this allows you to rotate the active key. Also a cipher command may be passed if a cipher other than AES is desired.

AUTHOR

Leon Timmermans <fawaka@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2024 by Leon Timmermans.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.