Base64 encoded string of the Security Credential, which is encrypted using public key : <p>I am working on an API that requires encryption of security credentials. I have not done any encryption.</p>

<p>Security credentials are generated by encrypting the base64 encoded password with a public key, a X509 certificate.</p>

<p>The algorithm for generating security credentials is as follows:
Write the unencrypted password into a byte array.
Encrypt the array with the public key certificate. Use the RSA algorithm, and use PKCS #1.5 padding (not OAEP), and add the result to the encrypted stream.
Convert the resulting encrypted byte array into a string using base64 encoding. The resulting base64 encoded string is the security credential.</p>

<p>Can anyone help me achieve this in php?</p>
