身份验证和安全

来自Chinese Ikoula Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

fr:Authentification et sécurité en:Authentication and security es:Autenticación y seguridad pt:Autenticação e segurança it:Autenticazione e protezione nl:Verificatie en beveiliging de:Authentifizierung und Sicherheit zh:身份验证和安全 ar:الأمان والمصادقة ja:認証とセキュリティ pl:Uwierzytelniania i zabezpieczeń ru:Проверка подлинности и безопасность ro:Autentificare și securitate he:אבטחה ואימות
这篇文章是从由软件进行自动翻译。你可以看到这篇文章的源代码

fr:Authentification et sécurité he:אבטחה ואימות ro:Autentificare și securitate ru:Проверка подлинности и безопасность pl:Uwierzytelniania i zabezpieczeń ja:認証とセキュリティ ar:الأمان والمصادقة zh:身份验证和安全 de:Authentifizierung und Sicherheit nl:Verificatie en beveiliging it:Autenticazione e protezione pt:Autenticação e segurança es:Autenticación y seguridad en:Authentication and security


介绍

如何进行身份验证的 API Ikoula 和政策 安全 ?

解释

Pour des raisons évidentes de 安全, l'API Ikoula exige une authentification. Celle-ci est basée sur un identifiant, un mot de passe et une 签名 :

  • ID 是用来连接您的 Ikoula 帐户的电子邮件地址或对外部网。要传递的名称是参数的总是 登录 ;
  • 因为它可能是,提供密码以明文形式 (参数 password)通过一个具体的功能,使用由 Ikoula 提供的公钥加密 (参数 crypted_password) 和基地64_encode ;
  • 基于调用 API 时提供的参数生成的签名 (看到签名生成过程 ==> Génération de la signature).


这些设置应始终以通过 GET api !

注意 :
通道的密码以明文形式提供,以便处理的 API,并作为调试。为给 API 测试,可以例如,使用致力于这些测试的临时用户和您使用明文密码进行身份验证 (看到苏 utilisateur 创建 Wiki: https://support.ikoula.com/index-1-2-2835.html).

与 Ikoula 公钥密码加密的使用在任何生产环境或非法院一词至关重要。
如果 API 调用注定要通过脚本或程序使用,我们建议您创建一个专用于此目的的用户而不是使用您的外联网用户经典。
你有两个选项 :

Attention à ne pas oublier de lui mettre les droits sur les prestations souhaitées.

公钥加密是密码的可在以下地址
https://api.ikoula.com/downloads/Ikoula.API.RSAKeyPub.pem

例子

对于此示例,将登录 "ikoulasupport".
若要加密的密码,下面是一个示例函数使用的公钥的 ikoula :

// Chemin local vers la clef publique téléchargée à http://api.ikoula.com/downloads/Ikoula.API.RSAKeyPub.pem
define('API_PUB_KEY_PATH', dirname(__FILE__) . '/Ikoula.API.RSAKeyPub.pem');
 
// Fonction de cryptage du mot de passe via la clef publique Ikoula
function opensslEncryptPublic($password)
{
        // Vérification de la présence de la clef publique
        if(file_exists(API_PUB_KEY_PATH))
        {
                if(!empty($password))
                {
                        // on récupére la clef public
                        $publicKey = openssl_pkey_get_public('file://'.realpath(API_PUB_KEY_PATH));
 
                        // Si il n'y a pas eu d'erreur lors de la récupération de la clef publique on continue
                        if ($publicKey !== FALSE)      
                        {
                                // Si chiffrement clef publique OK
                                if(openssl_public_encrypt($password, $crypted, $publicKey) === TRUE)   
                                {
                                        // Renvoie du passe crypté
                                        return $crypted;       
                                }
                                else
                                {
                                        return NULL;
                                }
                        }
                        else
                                return NULL;
                }
                else
                        return NULL;
        }
        else
        {
                echo("Erreur la clée public n'est pas présente.\n");
                return NULL;
        }
}
 
// Utilisation de la fonction de cryptage
$password_crypt = opensslEncryptPublic("Mot de passe non crypté");
if($password_crypt != NULL)
        echo "OK Mot de passe crypté: ".$password_crypt;
else
        echo "Erreur lors du cryptage du mot de passe.";

// ==> $password_crypt contient donc le mot de passe crypté

结论

一旦密码被加密的加密签名,我们可以做 API 调用带参数 (如果我们按照上面的例子) :

  • login = ikoulasupport ;
  • crypted_password = 基地64_encode($password_crypt) ;
  • signature = 生成的签名 (看到签名生成过程 ==> Génération de la signature).


毒品调查科 : 别忘了给每个参数传递的 url_encoder !



这篇文章似乎对你有用 ?

0

Catégorie:API



您未被允许发表评论。