this is what i am working with so far and works ok if all rows have  
the same encryption key:

   package RM::DB::Column::AESCrypt;

   use base 'Rose::DB::Object::Metadata::Column::Blob';

   sub select_sql {
     my $self = shift;

     my $value = q{AES_DECRYPT(body, 'SECRET')};
     return $value;
   }

   sub query_placeholder_sql {
     my $self = shift;

     my $value = q{AES_ENCRYPT(?, 'SECRET')};
     return $value;
   }

   *insert_placeholder_sql = \&query_placeholder_sql;
   *update_placeholder_sql = \&query_placeholder_sql;

   1;

any suggestions on how to get 'SECRET' to come from the object, which  
does not appear to be passed to these subs?


On Feb 28, 2007, at 2:13 PM, Michael Reece wrote:

> this looks very promising!  but what args are passed to select_sql,  
> etc?
>
> that is, from RM::DB::Column::AESCrypt sub select_sql, how can i
> inspect the row/object to use its special crypt key?
>
> On Feb 28, 2007, at 1:47 PM, John Siracusa wrote:
>
>> On 2/28/07, Michael Reece <[EMAIL PROTECTED]> wrote:
>>> is it possible to inflate/deflate columns using mysql functions via
>>> RDBO?
>>
>> If you're feeling daring, this API is still not public, but I'm  
>> pretty
>> sure it still works:
>>
>> http://www.mail-archive.com/rose-db-object@lists.sourceforge.net/
>> msg00710.html
>>
>> I haven't change it in a long time so it'll probably just become
>> public eventually, assuming I haven't made any fatal mistakes in the
>> API.  If you try it, let me know how it works for you.
>>
>> As for doing it client-side in Perl...
>>
>>> as an alternate solution, i am considering doing all the de/cryption
>>> work in perl, with the idea that i can inflate/deflate columns using
>>> RDBO triggers, but this part has me worried (re: inflate, deflate
>>> triggers):
>>>
>>>    Note that the value to be inflated may have come from the
>>> database, or from end-user code. Be prepared to handle almost
>>> anything.
>>>
>>> since the de/crypt should only happen with values to/from the db,  
>>> not
>>> from end-user code.
>>
>> That's no problem, you just have to be "prepared" to handle both  
>> cases
>> :)  You can detect where data is coming from and going to by using  
>> the
>> is_loading() and is_saving() utility functions:
>>
>> http://search.cpan.org/dist/Rose-DB-Object/lib/Rose/DB/Object/Util.pm
>>
>> Then just do the appropriate thing in each situation.
>>
>> -John
>>
>> --------------------------------------------------------------------- 
>> -
>> ---
>> Take Surveys. Earn Cash. Influence the Future of IT
>> Join SourceForge.net's Techsay panel and you'll get the chance to
>> share your
>> opinions on IT & business topics through brief surveys-and earn cash
>> http://www.techsay.com/default.php?
>> page=join.php&p=sourceforge&CID=DEVDEV
>> _______________________________________________
>> Rose-db-object mailing list
>> Rose-db-object@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/rose-db-object
>
> ---
> michael reece :: software engineer :: [EMAIL PROTECTED]
>
>
>
> ---------------------------------------------------------------------- 
> ---
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to  
> share your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php? 
> page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Rose-db-object mailing list
> Rose-db-object@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rose-db-object

---
michael reece :: software engineer :: [EMAIL PROTECTED]



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to