ParagonIE\EasyRSA\EasyRSA::rsaEncrypt PHP Method

rsaEncrypt() protected static method

Decrypt with RSAES-OAEP + MGF1+SHA256
protected static rsaEncrypt ( string $plaintext, PublicKey $rsaPublicKey ) : string
$plaintext string
$rsaPublicKey PublicKey
return string
    protected static function rsaEncrypt($plaintext, PublicKey $rsaPublicKey)
    {
        static $rsa = null;
        if (!$rsa) {
            $rsa = new RSA();
            $rsa->setEncryptionMode(RSA::ENCRYPTION_OAEP);
            $rsa->setMGFHash('sha256');
        }
        $rsa->loadKey($rsaPublicKey->getKey());
        return $rsa->encrypt($plaintext);
    }