Python
Python

Reputation: 1

xml file encryption with Python

i am making a mail client and i have made an option in which user can save his/her profile and i saving all details in an xml file using SXML lib in python . now i want that file to be encrypted otherwise any one can see the details...How do i Do dat?

Upvotes: 0

Views: 2109

Answers (2)

SubniC
SubniC

Reputation: 10317

I have been using a Recipe from Active state for some time, you can find stronger algorithms but if you just need to keep away the curious it will be ok :)

If you really need a higher degree of confidence you can try pyDES and use a TripleDES for the encryptation.

TripleDES

Upvotes: 1

user225312
user225312

Reputation: 131567

An easy way:

Accept the password from the user and then store it use base64.

>>> import base64
>>> print base64.b64encode("password")
cGFzc3dvcmQ=
>>> print base64.b64decode("cGFzc3dvcmQ=")
password

So encode the password and save it in the XML file and then when you want to read from it, decode it.

DOCS

PS: I am not saying this is highly secure, but still this will suffice for a casual glance at the file. Again if you need it to be really secure (is that even possible?), then you should find something else. This solution is more about being obscure.

Upvotes: 0

Related Questions