I'm trying to reproduce Java encryption using Cipher cipher = Cipher.getInstance("RSA");
with PHP and phpseclib.
I tried this and so many things, but it seems the data are not correctly encrypted
$rsa = new Crypt_RSA();
$rsa->setEncryptionMode(CRYPT_RSA_ENCRYPTION_OAEP);
$rsa->loadKey($pub_key);
$ciphertext = $rsa->encrypt($plaintext);
I tried different combination like
$rsa->setMGFHash('sha512');
$rsa->setHash('sha512');
//$rsa->setMGFHash('sha256');
//$rsa->setHash('sha256');
without success.
Am I missing something?