When loading a public RSA key (generated in golang) openssl_public_encrypt('data to encrypt', $ciphertext, $public_key, OPENSSL_PKCS1_PADDING); this error is returned openssl_public_encrypt(): key parameter is not a valid public key But if I generate a new RSA key in PHP and use that instead ...