I was trying to use the Paypal PHP SDK and I noticed a warning that says I should encrypt my API username and password for use in production environments. I do agree on this statement, but I’m wondering how I should go about doing that. I currently have no clue.
Here’s what the warning says, just for the record:
Do not embed plaintext credentials in your application code. Doing so
is insecure and against best practices. Your API credentials must be
handled securely. Please consider encrypting them for use in any
production environment, and ensure that only authorized individuals
may view or modify them.
Thanks in advance.
First, set an encryption key:
Encrypt it on DB entry or from another file and only store the encrypted string in the file itself:
Decrypt it later: