We've no feature to encrypt before storage and decrypt before display any field value. It's possible to encrypt before storage with CB Auto Actions, but decrypting before display could be tricky and you of course won't be able to use userlist searching on encrypted fields. The below should work to encrypt a fields value.
Global
Triggers: onAfterUserRegistration, onAfterNewUser, onAfterUserUpdate, onAfterUpdateUser
Type: Code
User: Automatic
Access: Everybody
Conditions
Field: Custom > Value
Custom Value: [var1_FIELD_NAME]
Operator: Not Equal To
Value: [var3_FIELD_NAME]
Action
Method: PHP
Code:
Code:
$variablies['var1']->FIELD_NAME = ENCRYPTION_CODE_HERE;
$variablies['var1']->store();
Parameters
References: Variable 1
The above would let you modify a fields value after it was stored using PHP. The field being FIELD_NAME and ENCRYPTION_CODE_HERE being your PHP code to encrypt its value. It should only apply this code if the fields value changes. Below is an explanation of the triggers used.
onAfterUserRegistration = frontend registration
onAfterNewUser = backend registration
onAfterUserUpdate = frontend edit
onAfterUpdateUser = backend edit
I don't have a solution for decrypting before display beyond maybe just using a CB Code Field to handle the display where you can use custom PHP to reverse the encryption if you used an encryption that can be reversed (e.g. openssl encrypt).