我有这段代码:
openssl_pkcs12_read($p12buf, $p12cert, $decPass);
openssl_pkey_export($p12cert['pkey'], $pemkey);
openssl_sign($toSign, $signature, $pemkey, OPENSSL_ALGO_SHA1);
openssl_free_key($pemkey);
我收到了这个警告:
Warning (2): openssl_free_key() expects parameter 1 to be resource, string given
我怎样摆脱它或我做错了什么?
答案 0 :(得分:1)
openssl_free_key需要openssl_pkey_get_private或openssl_pkey_get_public
的结果(资源)$key = openssl_pkey_get_private($keyFile, $passphrase);
openssl_free_key($key);