Using private + public different servers
nelsonvarela opened this issue · 2 comments
Hi There,
I have a Django project and I am using the encrypted field.
What I liked to do is only using encryption in his project. I did that by setting ENCRYPTED_FIELD_MODE = 'ENCRYPT'
This way there's no possibility to decrypt the encrypted value.
Step 2 is to decrypt the value from another project. At this point I'm stuck.
I'd like to decrypt the encrypted value from another server by using the private key. Can anyone explain me how I can do that?
I'm kinda new in the whole encrypting world especially using public and private keys.
I know there is a private and a public key. How can I save the private key on another server and use it to decrypt encrypted values?
Greetz, Nelson Varela.Using private + public different servers
Hi Nelson. I take it you solved your problem?
Yes I did solve my problem by creating public keys AND private keys ass follows:
$ mkdir private
$ mkdir public
$ keyczart create --location=private --name="my project" --purpose=crypt --asymmetric=rsa
$ keyczart addkey --location=private --status=primary --size=256
$ keyczart pubkey --location=private --destination=public
When deploying the project in production one should copy the 'public' folder and use the following settings:
ENCRYPTED_FIELDS_KEYDIR = '/path/to/public'
ENCRYPTED_FIELD_MODE = 'ENCRYPT'
If you want to decrypt and encrypt use the following:
ENCRYPTED_FIELDS_KEYDIR = '/path/to/private'
ENCRYPTED_FIELD_MODE = 'DECRYPT_AND_ENCRYPT'