Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using private + public different servers #3

Closed
nelsonvarela opened this issue Nov 19, 2013 · 2 comments
Closed

Using private + public different servers #3

nelsonvarela opened this issue Nov 19, 2013 · 2 comments

Comments

@nelsonvarela
Copy link

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

@defrex
Copy link
Owner

defrex commented Nov 19, 2013

Hi Nelson. I take it you solved your problem?

@nelsonvarela
Copy link
Author

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' 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants