I don't know the detail of your scenario and your problem, but is you really want to store a password, no matter where, this is a totally wrong approach. Real authentication systems do not store password, in its original form, anywhere. It is absolutely not needed for authentication; and the password belongs only to the person who created it, no one else. Surprised, feel disagree? Keep reading.
The usual approach i using cryptographic hash function
to store it and to compare it with cryptographic hash function of a password. You can compare it, but it's cryptographic infeasible
to restore the original password from hash value. For further detail, please see my past answers:
i already encrypt my password but when i log in it gives me an error. how can decrypte it
Decryption of Encrypted Password
storing password value int sql server with secure way