Backdoor access for Memories by calling write/read tasks from memory model

I wanted to find out if there’s any standard practice/methodology used for backdoor write/read for the memories that support encryption. We have to go through write/read tasks implemented in memory model in order to access memory-array because of the encryption/decryption logic. That makes it challenging to use RAL with hdl_path as it accesses the memory-array directly.

One of the solutions would be to use hierarchical design path and call those backdoor write/read tasks but it will be more static and not very friendly when there’re many memories with multiple banks. I’m looking for more flexible approach similar to uvm_hdl_deposit/uvm_hdl_read used in RAL where we can pass the path as a string but to call write/read tasks/functions instead of directly accessing the memory-array.

Let me know if you have come across similar requirement and found a better solution making use of RAL or any other standard approach.

Thanks!