AnsweredAssumed Answered

Encrypt with blowfish

Question asked by tobydz on Mar 7, 2016
Latest reply on Mar 7, 2016 by tobydz

I'm going crazy trying to copy one encrypted field into another one.  All I've been able to find is the blowfishDecode() method (which works):

blowfishDecode(blowfishGetKey('encrypt_field'), $clientBean->dl_num_c);

 

So what's the opposite?  What's a code example for going the other way if I want to "blowfishEncode" the field data? It's the only other thing I can think of here.

 

I'm trying to copy an encrypted driver's license number between two encrypted fields in a logic hook, and no matter what I do, it's ALWAYS garbled in the DetailView.  I've done (keep in mind if I echo / die out the value of the encrypted variable, it looks just fine):

// Plain copy

$bean->enc_field1 = $bean->enc_field2;

 

// Use an intermediary

$val = $bean->enc_field1;

$bean->enc_field2 = $val;

 

// Try decoding first to a variable then set the value

$val = blowfishDecode(blowfishGetKey('encrypt_field'), $bean->enc_field1);

$bean->dl_num_c = $dlNum;

 

It comes out encrypted every. single. time.

 

Please save my sanity... I even filed a bug with Sugar Support and THEY didn't even know how to do it.... (although were still very timely and helpful =P)

Outcomes