1

我尝试了这个简单的代码:

<?php

$publicKey = openssl_pkey_get_public("public.pem");
$plaintext = "String to encrypt";

openssl_public_encrypt($plaintext, $encrypted, $publicKey);

echo $encrypted;   //encrypted string

?>

但我收到此错误消息。

警告:openssl_public_encrypt(): key parameter is not a valid public key in C:\xampp\htdocs\encrypt\encrypt_rsa.php 第 6 行

4

0 回答 0