I have two binary buffers containing the modulus and exponent of a public RSA key in PHP (both in big-endian). I need to convert these two values to a PEM formatted string so that it can be used to encrypt data with the openssl extension, for example with openssl_public_encrypt
.
When researching this topic, I only found solutions using phpseclib, which I cannot use in this scenario. How can I convert the values manually (as I think openssl doesn't offer such functionality)?