Answer the question
In order to leave comments, you need to log in
Why is the public key not valid?
I generated the key with the openssl.exe program:
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyfFQSZEUlce53iq8CqKq
tRFKkmtn5rrgGk3G/L27nH1tmXxg8egSPJavO+OoS61V7ALBbfffc2srVI/HXBAu
sK1bLLVSQRp3qIvsa/Mqx6vWrujRsCg5Sy5nEaxWEJa6ngRXl3k3LcAG7pOXIr0A
DXlZ3ySdLiNSVX7Ny/0fTv8aqUbSQBweJ16YFTVqer2PEV+xN28Qxd0qhHr32r/I
VSqGtV6md68qhDiJr33in4bvQLtXmp/20N1ACfpU5CyPXMa+QfD2DyyQseHg6TLT
RugZzAW0EgGNUZz/54956U1IjRmpOjSEKusKGheiG4bkfbhlDOPrSlYDgw6CqSKF
UwIDAQAB
-----END PUBLIC KEY-----
openssl_public_encrypt(): key parameter is not a valid public key
$encrypted = '';
$data = "Hello world";
$pk = openssl_get_publickey("../public.pem");
openssl_public_encrypt($data, $encrypted, $pk);
echo chunk_split(base64_encode($encrypted));
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question