safaricom / mpesa-php-sdk

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

Security Credential #56

Open tmhevencent opened 11 months ago

tmhevencent commented 11 months 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);