Discussions

Ask a Question
Back to All

Error with the KeyId procedure

Hi, i generated an RSA Public Key:

-----BEGIN PUBLIC KEY-----
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA+mAcUiaisHkSLPe+ZUQk
B3G2JfFS3qLITKPPpwQZw78riCsQdC/AkMg6bILoql6/NIWvaev/tVR/QWUlpLW6
rVKwPVf0Eq4KK27aYlWFvTn3VNeWIsEAx24NWgqwhYCvMTPkUohQEgdNWUXxww0K
gftr/FN04paX5IhxfEPtCWHn4R3cOcMBfleWPKqHwQiwBQ1pvjox8Ks84f9Nl/qe
nSXHsP8RfeChxH/sh3pVazvlWUfBY0rCiz4W+5xx+D6dS9EwwgZXu2JtnhhKpWng
WvDo9LMudKKoo7mp1OM7HsSKOHgw9979Ldhu5j+09U9y4DaKscY8umbJ4tc4mQ4f
0RqjLekjEQYJwl1JQFCguYBNH666iB9QOpB6SuuNCxtf8fOASyAXgrYBO+nUy0tr
A9S6Y2TGw4Ks5mRUkMblAfkRCFT6jmU+ThiC4Tt03Znhl/vu5Ss/uSXmTpp/Z6EE
e53bqNHUf+eCoVohy3OCoZIeZYQNkXUnKMHR0907gsmcfDku00CSMfastPj0dskQ
+aNObHDe370m4+/29QnFkf+BLRMAKjQIUZ1z/T9yN9WxfLoifi3ewUgcVY58PpRu
T1ReVSk+rsGSAyww2Y/mu/Ktpn+MMIWyIHrzn0tvpnotpQ2gSfYCYiNRFQGAarYl
oJnRXuq9kfq+b3o0WGiLGQkCAwEAAQ==
-----END PUBLIC KEY-----

When i try to generate the keyId i have two type of error:

  1. $curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://authservices.satispay.com/g_business/v1/authentication_keys",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{"public_key":"MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA+mAcUiaisHkSLPe+ZUQkB3G2JfFS3qLITKPPpwQZw78riCsQdC/AkMg6bILoql6/NIWvaev/tVR/QWUlpLW6rVKwPVf0Eq4KK27aYlWFvTn3VNeWIsEAx24NWgqwhYCvMTPkUohQEgdNWUXxww0Kgftr/FN04paX5IhxfEPtCWHn4R3cOcMBfleWPKqHwQiwBQ1pvjox8Ks84f9Nl/qenSXHsP8RfeChxH/sh3pVazvlWUfBY0rCiz4W+5xx+D6dS9EwwgZXu2JtnhhKpWngWvDo9LMudKKoo7mp1OM7HsSKOHgw9979Ldhu5j+09U9y4DaKscY8umbJ4tc4mQ4f0RqjLekjEQYJwl1JQFCguYBNH666iB9QOpB6SuuNCxtf8fOASyAXgrYBO+nUy0trA9S6Y2TGw4Ks5mRUkMblAfkRCFT6jmU+ThiC4Tt03Znhl/vu5Ss/uSXmTpp/Z6EEe53bqNHUf+eCoVohy3OCoZIeZYQNkXUnKMHR0907gsmcfDku00CSMfastPj0dskQ+aNObHDe370m4+/29QnFkf+BLRMAKjQIUZ1z/T9yN9WxfLoifi3ewUgcVY58PpRuT1ReVSk+rsGSAyww2Y/mu/Ktpn+MMIWyIHrzn0tvpnotpQ2gSfYCYiNRFQGAarYloJnRXuq9kfq+b3o0WGiLGQkCAwEAAQ==","token":"GPU7GG"}",
CURLOPT_HTTPHEADER => [
"Accept: application/json",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}

When i load this, it gave me an Invalid RSA key error:
ERROR: {"code":132,"message":"Bad request. Invalid RSA key","wlt":"gZI7GXPb"}

  1. $curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://authservices.satispay.com/g_business/v1/authentication_keys",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{"public_key":"MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA+mAcUiaisHkSLPe+ZUQk\nB3G2JfFS3qLITKPPpwQZw78riCsQdC/AkMg6bILoql6/NIWvaev/tVR/QWUlpLW6\nrVKwPVf0Eq4KK27aYlWFvTn3VNeWIsEAx24NWgqwhYCvMTPkUohQEgdNWUXxww0K\ngftr/FN04paX5IhxfEPtCWHn4R3cOcMBfleWPKqHwQiwBQ1pvjox8Ks84f9Nl/qe\nnSXHsP8RfeChxH/sh3pVazvlWUfBY0rCiz4W+5xx+D6dS9EwwgZXu2JtnhhKpWng\nWvDo9LMudKKoo7mp1OM7HsSKOHgw9979Ldhu5j+09U9y4DaKscY8umbJ4tc4mQ4f\n0RqjLekjEQYJwl1JQFCguYBNH666iB9QOpB6SuuNCxtf8fOASyAXgrYBO+nUy0tr\nA9S6Y2TGw4Ks5mRUkMblAfkRCFT6jmU+ThiC4Tt03Znhl/vu5Ss/uSXmTpp/Z6EE\ne53bqNHUf+eCoVohy3OCoZIeZYQNkXUnKMHR0907gsmcfDku00CSMfastPj0dskQ\n+aNObHDe370m4+/29QnFkf+BLRMAKjQIUZ1z/T9yN9WxfLoifi3ewUgcVY58PpRu\nT1ReVSk+rsGSAyww2Y/mu/Ktpn+MMIWyIHrzn0tvpnotpQ2gSfYCYiNRFQGAarYl\noJnRXuq9kfq+b3o0WGiLGQkCAwEAAQ==","token":"GPU7GG"}",
CURLOPT_HTTPHEADER => [
"Accept: application/json",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}

When i add the '\n' on every newline, it gave me an Bad request or invalid json error:
{"code":36,"message":"Bad request or invalid json","wlt":"JcRLf3Xn","data":[{"key":"#","message":"invalid json"}]}

I don't know what i fail, please help me.