问题
I have this code:
openssl_pkcs12_read($p12buf, $p12cert, $decPass);
openssl_pkey_export($p12cert['pkey'], $pemkey);
openssl_sign($toSign, $signature, $pemkey, OPENSSL_ALGO_SHA1);
openssl_free_key($pemkey);
I get this warning:
Warning (2): openssl_free_key() expects parameter 1 to be resource, string given
How can i get rid of it or what I am doing wrong?
回答1:
openssl_free_key require the result (resource) of openssl_pkey_get_private or openssl_pkey_get_public
$key = openssl_pkey_get_private($keyFile, $passphrase);
openssl_free_key($key);
来源:https://stackoverflow.com/questions/17726342/openssl-free-key-expects-parameter-1-to-be-resource