[Dbix-class] Is there a plugin for encrypting/decrypting columns on the fly

fREW Schmidt frioux at gmail.com
Fri May 11 16:58:26 GMT 2012


Hi Robert,

I haven't seen one, and I also do *not* know the best way to store
encrypted data in a database, but I do have something that works:

package MyApp::Schema::Result::ActiveDirectoryServer;

use parent 'MyApp::Schema::Result';

__PACKAGE__->load_components('FilterColumn');

...

__PACKAGE__->filter_column( bind_password =3D> {
   filter_to_storage =3D> 'encrypt',
   filter_from_storage =3D> 'decrypt',
});

my $cipher =3D Crypt::CBC->new(
   -key    =3D> 'my secret key', # STORE THIS SOMEWHERE CAREFULLY
   -cipher =3D> 'Blowfish'
);

sub encrypt { $cipher->encrypt_hex($_[1]) }

sub decrypt { $cipher->decrypt_hex($_[1]) }

1;


On Fri, May 11, 2012 at 8:42 AM, Robert Rothenberg <robrwo at gmail.com> wrote:

> Is there a DBIC plugin akin to DBIx::Class::PassphraseColumn or
> DBIx::Class::EncodedColumn, but which uses a reversible encryption method
> that can be used to decode values on the fly?
>
>
>
> _______________________________________________
> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
> Searchable Archive:
> http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk
>



-- =

fREW Schmidt
http://blog.afoolishmanifesto.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20120511/9d9=
75685/attachment.htm


More information about the DBIx-Class mailing list