Encrypting serialized Attribute


I’d like to encrypt the content of a serialized attribute with rails
built in serialize declaration. Unfortunately, using the before_save
and after_find callbacks for encryption does not work in this case,
because they are called before serialization and after

Is there a way to implement custom callbacks like after_serialize and
before_deserialize or any other recommended way of implementing
encryption of serialized attributes?

Many thanks