title: Storing Passwords in reversible form
body: <p>I have a PHP app that needs to run bash scripts, and provide a username &amp; password (for remote systems).
  I need to store these credentials somewhere that is accessible by my PHP (web) app.
  The logical place is the database (currently MySQL, but will be agnostic).
  The problem with the "standard" way of hashing and storing the credentials, is that it is not reversible. I <em>have</em> to be able to get the credentials out as unencrypted clear text, to be able to insert the data into bash scripts.</p>
  
  <p>Does anyone have any suggestions for a secure way to go about this ?</p>
  
  <p>I thought maybe PKI'ing the credentials, and storing the result in the DB. Then use the private key to unencrypt (PHP can do that). Store the scripts to do this outside the web root.</p>
  
  <p>Any thoughts much appreciated.</p>