presidio
presidio copied to clipboard
Feature: Pluggable Encryption
Right now we have only AES Cipher and use of any other cipher requires code modification of the product. Instead, I propose use of pluggable Cipher, so that we can avoid code modification. On a separate note, it is likely to help to gain attention for production grade adoption.
If you like the idea, vote for it.
Since our approach is usually using external libraries for such implementations, like we used pycryptodome for AES, I'm having trouble thinking how this can be pluggable, as the installation of those libraries needs to be plugabble as well. What did you have in mind with regards to that? For presidio as package use, we have a custom operator that can accept a function as callback and use if for the anonymization and deanonymization, is this similar to what you've suggested?
Yes, you are correct about required package installation and then we need to load the cipher class dynamically. All the parameters can be passed through regular Operator config. Something like below:
import sys
def install(package):
subprocess.check_call([sys.executable, "-m", "pip", "install", package])
mod = __import__('package.my_module', fromlist=['my_class'])
klass = getattr(mod, 'my_class')