I am trying to read and write username and password in a secured manner. With my current implementation I am following AES-CBC encryption/decryption but storing the encrypted username the with random key in a config file is a security issue. I found an option that keystore is a better way of storing passwords. I have checked similar question but the information is not clear to me. Another option that I found is the keyring, it is working fine in windows but on Linux , I am getting following error. I have checked for the possible solutions but couldn't find one.
python keyring-test.py
Traceback (most recent call last):
File "keyring-test.py", line 3, in <module>
keyring.set_password(service_name="demo-service",username="admin",password="test")
File "/usr/lib/python2.7/site-packages/keyring/core.py", line 64, in set_password
_keyring_backend.set_password(service_name, username, password)
File "/usr/lib/python2.7/site-packages/keyring/backends/fail.py", line 23, in get_password
raise RuntimeError(msg)
RuntimeError: No recommended backend was available. Install the keyrings.alt package if you want to use the non-recommended backends. See README.rst for details.
Can someone suggest me any better solution or modules from python to store passwords securely?
My implementation whas this: I made a random string and store it to a txt file then encrypt its bytes file under a key! I use two function that i have made which the
def encrypt_filetakes a file encrypt their bytes and returns an encrypted file anddef dencrypt_filedoes the opposite .The parameters are