The signature generation

From EN Ikoula wiki
⧼vector-jumptonavigation⧽ ⧼vector-jumptosearch⧽

en:The signature generation he:הדור חתימה ru:Создание подписи ja:署名の生成 ar:توليد التوقيع zh:签名生成 ro:Generația semnături pl:Generowanie podpisu de:Die Signatur-generation nl:De handtekening generatie it:La generazione della firma pt:A geração de assinatura es:La generación de una firma fr:Génération de la signature

Introduction

During a call to the API, as described in the WIKI of authentication, a signature is required. It is generated based on all of the parameters provided during the call .
For technical reasons and for the moment, the authentication parameters must 'always be transmitted via the HTTP GET method

Example

// Définition des paramètres
$data["login"] = "mail@example.com ";
$data["password"] = "DH 4=674j_G "; // Mot de passe non chiffré
// D"autres paramètres peuvent êtres ajoutés en fonction de l"appel à l"API
// $data["autre_parametre"] = "valeur";
// $data["autre_parametre_2"] = "valeur_2";
// $data["..."] = "...";
 
// Triage des paramètres dans l'ordre croissant
ksort($data);
 
// Encodage des paramètres
$query = http_build_query($data);
 
// Encodage des signes plus
$query = str_replace("+", "%20", $query);
 
// Transformation de la chaîne de caractères en minuscule
$query = strtolower($query);
 
// Clé publique d'Ikoula (cf. lien ci-dessus)
$public_key="MIIBIjAN...";
 
// Hashage des paramètres
$hash = hash_hmac("SHA1", $query, $public_key, true);
 
// Encodage en base64, puis encodage en URL selon RFC 3986
$signature  = rawurlencode(base64_encode($hash));
 
// ==> $signature  contient alors la signature  finale

Conclusion

Once the signature is generated, it is necessary to pass it as a parameter (In addition to all the other parameters ) to the API call.
Following the previous example, parameters to pass would have therefore been :

  • login = "mail@example.cOM "
  • password = "DH 4=674j_G "
  • signature = $signature



This article seemed you to be useful ?

0


You are not allowed to post comments.