title: Store and retrieve password in database
body: <p>I am developing an app which uses several API services, the API requires that I provide username and password for API transactions, unfortunately no API token :-( in-order to automate I need to store username passwords somewhere, preferably database, I cannot use hashing because I need to send the username/password to authenticate and process API request, hence I am wondering how to go about it.</p>
  
  <p>If I use <a href="http://framework.zend.com/manual/current/en/modules/zend.crypt.introduction.html" rel="nofollow noreferrer">Zend\Crypt</a> to encrypt and store the password in database and decrypt whenever required, would this be enough for security? is there something else I must consider? </p>
  
  <p>Looking for pointers.</p>
  
  <p>PS: I am using ZendFramework2 with Doctrine/MySQL for the app.</p>