Matias
Matias

Reputation: 265

how to save a password in a file of configuration in python

I'm writing an applet in python for gnome2 that checks for new emails in gmail.

Actually i'm saving the pass of gmail in a file .config using an encoding base-64. and then decoding the pass everytime i need it.

is this secure?? it's a better way to store a password??

Thanks

Upvotes: 3

Views: 941

Answers (1)

Martijn Pieters
Martijn Pieters

Reputation: 1121972

No, it's not secure. Instead, you should use the Gnome keyring service, or whatever the current system offers, to store passwords.

See the keyring package for a Python interface to such services:

import keyring

keyring.set_password('your_application_name', username, password)

keyring will store your password in the most secure keyring available, use get_password('your_application_name', username) to retrieve it again.

Upvotes: 7

Related Questions