时间:2021-07-01 10:21:17 帮助过:7人阅读
extension_loaded('openssl') or die('openssl扩展未安装');
$pukey='-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCivkFM06PJ2agLiF3rMyItmXbC
756SnYzJCPF2sBfUqxi8U/TFY72y5U4EdbgQMF+aP4ldBPUYpCXE7R6oQ96AEx/I
NCj9MDxGspXONXT4aPEkfNo7od0LzdLTLg+tdJklk7gti8jZg7kmuW3eG367KdEm
58Q116H+FI1D48kTNwIDAQAB
-----END PUBLIC KEY-----
';
$pikey='-----BEGIN RSA PRIVATE KEY-----
MIICXgIBAAKBgQCivkFM06PJ2agLiF3rMyItmXbC756SnYzJCPF2sBfUqxi8U/TF
Y72y5U4EdbgQMF+aP4ldBPUYpCXE7R6oQ96AEx/INCj9MDxGspXONXT4aPEkfNo7
od0LzdLTLg+tdJklk7gti8jZg7kmuW3eG367KdEm58Q116H+FI1D48kTNwIDAQAB
AoGBAJFLySMdRPr+n0CEpE1LnrUVcWmC45FEpiAKIwJzHyOZCgGB92OPtBqXDPuA
Wi/h8EjXdv0cYvJ4Atx5U0ipJ2jGrnBsxOx2pDj5TfrobNlaLlvK0N3Gqrb3l5kW
XUAJHe9kBReyNaenwkUPnMJ00QHReUUqtxCieM6trEicj9IxAkEAzgage1kFsDSs
tFxskHiADwKS4zoILMQ6LYY+1k7L+znRcU3k/a+/KiBzUIfOeDg2wcS60tknPqt0
cS8KWcvtWQJBAMo38psD8rTtg30mdSJpldlcuXQVUuDKnggseszeWKZaumE3H/pL
3XiT8zkl5UdNJ/N2AdeRRoPisxrJQ48bIw8CQFJy3nheaONaQR8wuZWbU4wuOIBM
sgbQRIQBbFYxVHpmagXQ6WoIkhUWxW8d2ifMP0WOKEHG+2ieDsxYyeijrokCQQCg
5ldhRIjvsTS4dcsp8H1NEFx3oyfouQ95TXsAW8KJyxMVmzkUfRzhfkc/J4oBa8Do
FPNuRKeo9M6x94aL7Xm9AkEApj3ixqfITd8gl1EO+mZb5rUgnW9nR37ExiQSMihO
pRQh1Igfmm90d+i7KYcTImwj5F5ofZS/Kvb737VRKLlJ6A==
-----END RSA PRIVATE KEY-----';
var_dump(openssl_pkey_get_private($pikey));
var_dump(openssl_pkey_get_public($pukey));
phpinfo();可看到openssl 扩展已安装
但是所有 openssl_* 函数都返回 false,
extension_loaded('openssl') or die('openssl扩展未安装');
$pukey='-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCivkFM06PJ2agLiF3rMyItmXbC
756SnYzJCPF2sBfUqxi8U/TFY72y5U4EdbgQMF+aP4ldBPUYpCXE7R6oQ96AEx/I
NCj9MDxGspXONXT4aPEkfNo7od0LzdLTLg+tdJklk7gti8jZg7kmuW3eG367KdEm
58Q116H+FI1D48kTNwIDAQAB
-----END PUBLIC KEY-----
';
$pikey='-----BEGIN RSA PRIVATE KEY-----
MIICXgIBAAKBgQCivkFM06PJ2agLiF3rMyItmXbC756SnYzJCPF2sBfUqxi8U/TF
Y72y5U4EdbgQMF+aP4ldBPUYpCXE7R6oQ96AEx/INCj9MDxGspXONXT4aPEkfNo7
od0LzdLTLg+tdJklk7gti8jZg7kmuW3eG367KdEm58Q116H+FI1D48kTNwIDAQAB
AoGBAJFLySMdRPr+n0CEpE1LnrUVcWmC45FEpiAKIwJzHyOZCgGB92OPtBqXDPuA
Wi/h8EjXdv0cYvJ4Atx5U0ipJ2jGrnBsxOx2pDj5TfrobNlaLlvK0N3Gqrb3l5kW
XUAJHe9kBReyNaenwkUPnMJ00QHReUUqtxCieM6trEicj9IxAkEAzgage1kFsDSs
tFxskHiADwKS4zoILMQ6LYY+1k7L+znRcU3k/a+/KiBzUIfOeDg2wcS60tknPqt0
cS8KWcvtWQJBAMo38psD8rTtg30mdSJpldlcuXQVUuDKnggseszeWKZaumE3H/pL
3XiT8zkl5UdNJ/N2AdeRRoPisxrJQ48bIw8CQFJy3nheaONaQR8wuZWbU4wuOIBM
sgbQRIQBbFYxVHpmagXQ6WoIkhUWxW8d2ifMP0WOKEHG+2ieDsxYyeijrokCQQCg
5ldhRIjvsTS4dcsp8H1NEFx3oyfouQ95TXsAW8KJyxMVmzkUfRzhfkc/J4oBa8Do
FPNuRKeo9M6x94aL7Xm9AkEApj3ixqfITd8gl1EO+mZb5rUgnW9nR37ExiQSMihO
pRQh1Igfmm90d+i7KYcTImwj5F5ofZS/Kvb737VRKLlJ6A==
-----END RSA PRIVATE KEY-----';
var_dump(openssl_pkey_get_private($pikey));
var_dump(openssl_pkey_get_public($pukey));
phpinfo();可看到openssl 扩展已安装
但是所有 openssl_* 函数都返回 false,
用这个命令试试呢
php -m|grep openssl