多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
client.php ~~~ <?php $public = '-----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuDhX5wRAJdLUV15cfTuK 4dgkUJTiIGsCztrPKB6K+gVvvAilHddafiWJ4IVJJD7VrEamuyhB5xftfD0qMl28 NEr6zbtwBc6iYXznXtMgyuOIUL+4aghCjuJBxmlpKvL1Cv3Qi2pQz/zeOpE4mQhH Jo2oFDRap2qjXnuh7vP/8DsyqL44rRmiBFUJmU6aJSN6+qTlKLOg+mrP0REXmxtH 2rgnz6gO8bmZjot6r8tZYmJorTW1ZKa1upQvHAjdxYr6KHZYH/N76Vnb8qCamjfB rU7EFwqJnQSBuc7j6u1a/yvqqnCtcXTNKqiby62hejHxoql4ZVm8u1w7S5Da/0hs FwIDAQAB -----END PUBLIC KEY-----'; $appKey = 'rwerjsKsdsWewe'; $secretKey = 'VSdsdhdsdwllkoplsK4d'; $url = 'http://127.0.0.6/server.php?'; $params['appKey'] = $appKey; $params['orderId'] = 1; $params['name'] = 'sdsdsdwew'; $params['password'] = '123456'; $params['time'] = time(); $queryString = http_build_query($params); //var_dump($queryString); $sign = getSign($params, $secretKey); $queryString .= '&sign='.$sign; //$url .= $queryString; //var_dump($url); $encrypt=''; openssl_public_encrypt($queryString,$encrypt,$public); $encrypt=urlencode($encrypt); $url.='q='.$encrypt; var_dump($url); function getSign($params, $secretKey){ ksort($params); $q = http_build_query($params); $q .= $secretKey; return md5($q); } ~~~ server.php ~~~ <?php $private = '-----BEGIN PRIVATE KEY----- MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQC4OFfnBEAl0tRX Xlx9O4rh2CRQlOIgawLO2s8oHor6BW+8CKUd11p+JYnghUkkPtWsRqa7KEHnF+18 PSoyXbw0SvrNu3AFzqJhfOde0yDK44hQv7hqCEKO4kHGaWkq8vUK/dCLalDP/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BRAoGAaLWQ t80taFpdOZmQv4xEUiITZ9Uicyb3ZwxC00sr5Sef/DSsJPxwYEdnLNLPsZgxNoew 4dR86txL1MWskcQPAp4W2Zp9/U/1mCdSxs7VMIz3U5euBq9xQ4NGCpqajdFSAuWU rFuQtV+NIwg+ibduUptdzGxqTX+18JH5N/GdBM0CgYB1eyuNQRp5a3FwMlpIJ6PI +lK76J5WIBuOvJ0Mmz/BydrohtdboztM8AZp+efFNihzrKGPQ1CfWumNALppekg3 CtOyvg3V5VhyEiqN4XYJtmg4WhSWP7yaRYyMQN6r7YpzaEtzl34Si06yWKPqMDRg 4KtgHiAQcNRBIvjyRlM8Gw== -----END PRIVATE KEY-----'; $query=$_GET['q']; //var_dump($query); $decrypt=''; $query=openssl_private_decrypt($query,$decrypt,$private); $params=[]; parse_str($decrypt,$params); var_dump($params); $sign=getSign($params); if($sign!=$params['sign']){ //连接被修改 die('error'); } echo 'succ'; function getSign($params){ $conf=[ 'rwerjsKsdsWewe'=>'VSdsdhdsdwllkoplsK4d' ]; if(abs($params['time']-time())>=600){ //连接超时 } unset($params['sign']); ksort($params); $q=http_build_query($params); return md5($q.$conf[$params['appKey']]); } ~~~