Management Commands¶
sage_encrypt provides 2 management commands:
encryptdb
python manage.py encryptdb --table <table_name> --column <col_name> --cast <field_previous_cast_type> --algorithm <algorithm> #(symmetric/asymmetric)
Options:
–database (if you have multiple db’s specify for your database)
–table (table name in your database not django model title)
–column (col name in the specified table)
–algorithm (symmetric/asymmetric)
–cast (field previous cast that you want to encrypt from that)
Usage:
When you want to add encryption on a row and there is valuable data in you db, you can encrypt the data to be compatible with Encrypted Field.
decryptdb
python manage.py decryptdb --table <table_name> --column <col_name>
Options:
–database (if you have multiple db’s specify for your database)
–table (table name in your database not django model title)
–column (col name in the specified table)
Usage:
When your data is encrypted in db and you want to remove encryption from a row, for getting back data you can use this command, it decrypts data and replaces in your db.