문제

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?

도움이 되었습니까?

해결책

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);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top