There are some instances, you want to store your passwords in files to be used by the programs or scripts. But storing your passwords in plain text is not a good idea. Use the SecurePasswordVault to encrypt your passwords before storing and get it decrypted when you want to use it.
You can use the SecurePasswordVault described here to store any number of encrypted passwords. Passwords are stored as key value pairs.
Key - any name given by the user for the password
Value - encrypted password
SecurePasswordVault will create a file with the given name in the working directory if it doesn't exist. If a file exist then the information in that file will be read.
Passwords are encrypted using the MAC address of the network card. SecurePasswordVault will use the first network card MAC which is not the loop back interface. So the encrypted file can only be decrypted with that particular MAC address. If you want to reset the pass word details, just delete the password file and run the SecurePasswordVault.
You can download the sample code from the following Github repository