safaricom / mpesa-php-sdk

A PHP sdk for the new Mpesa RESTful APIs
188 stars 219 forks source link

Security Credential #56

Open tmhevencent opened 1 year ago

tmhevencent commented 1 year ago

Do you have a clear way of how SecurityCredential is generated? I have tried but keeps failing.

$certFile = 'mpesa_public_cert.cer'; $certContent = file_get_contents($certFile); $publicKey = openssl_pkey_get_public($certContent); $encrypted = ''; openssl_public_encrypt($plaintext, $encrypted, $publicKey, OPENSSL_PKCS1_PADDING); return base64_encode($encrypted);