Using private + public different servers

7 views
Skip to first unread message

Nelson Varela

unread,
Nov 19, 2013, 7:06:55 AM11/19/13
to django-e...@googlegroups.com
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.


Nelson Varela

unread,
Nov 20, 2013, 9:31:12 AM11/20/13
to django-e...@googlegroups.com
I solved 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'


Reply all
Reply to author
Forward
0 new messages