当前位置: 首页>>代码示例>>PHP>>正文


PHP StringHelper::encrypt方法代码示例

本文整理汇总了PHP中StringHelper::encrypt方法的典型用法代码示例。如果您正苦于以下问题:PHP StringHelper::encrypt方法的具体用法?PHP StringHelper::encrypt怎么用?PHP StringHelper::encrypt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StringHelper的用法示例。


在下文中一共展示了StringHelper::encrypt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: save

 public static function save($account)
 {
     $account->credentials = StringHelper::encrypt($account->credentials, md5(Auth::user()->username));
     return $account->save();
 }
开发者ID:XDocker,项目名称:app,代码行数:5,代码来源:CloudAccountHelper.php

示例2: prepare

 private function prepare($user, $account, &$deployment)
 {
     $credentials = json_decode($account->credentials);
     $parameters = json_decode($deployment->parameters);
     $dockerParams = xDockerEngine::getDockerParams($deployment->docker_name);
     $rawApiKey = StringHelper::encrypt($credentials->apiKey, md5(Auth::user()->username));
     $rawSecretKey = StringHelper::encrypt($credentials->secretKey, md5(Auth::user()->username));
     if (xDockerEngine::billingBucket($deployment->docker_name) && empty($credentials->billingBucket)) {
         Log::error('error', 'Billing bucket is mandatory for ' . $deployment->docker_name);
         return Redirect::to('account/' . $account->id . '/edit')->with('error', 'Billing bucket is mandatory for ' . $deployment->docker_name);
     }
     $secPolicy = xDockerEngine::securityPolicy($deployment->docker_name);
     if (!empty($secPolicy)) {
         $keys = array_keys($secPolicy);
     } else {
         $keys[0] = 0;
         $secPolicy[0] = '';
     }
     $keys = !empty($secPolicy) ? array_keys($secPolicy) : '';
     if (xDockerEngine::isAppCredEanbled($deployment->docker_name)) {
         if (empty($parameters->app_username) || empty($parameters->app_username)) {
             Log::error('App Username/Password are required fields for ' . $deployment->docker_name);
             return Redirect::back()->with('error', 'App Username/Password are required fields for ' . $deployment->docker_name);
         }
     }
     $userArr = array('app_username' => $parameters->app_username, 'app_psw' => crypt($parameters->app_psw, base64_encode($parameters->app_psw)));
     $env = $dockerParams['env'];
     $dockerParams['env'] = array_merge($env, $userArr);
     $deployment->wsParams = json_encode(array('token' => $deployment->token, 'username' => $user->username, 'cloudProvider' => $account->cloudProvider, 'apiKey' => $rawApiKey, 'secretKey' => $rawSecretKey, 'billingBucket' => !empty($credentials->billingBucket) ? $credentials->billingBucket : '', 'instanceName' => $deployment->name, 'instanceType' => $parameters->instanceType, 'instanceRegion' => $parameters->instanceRegion, 'instanceAmi' => $parameters->instanceAmi, 'OS' => $parameters->OS, 'packageName' => $deployment->docker_name, 'sgPorts' => $parameters->sgPorts, 'dockerParams' => $dockerParams, 'ipUI' => xDockerEngine::getIPAddress($deployment->docker_name), $keys[0] => $secPolicy[$keys[0]]));
 }
开发者ID:XDocker,项目名称:app,代码行数:30,代码来源:DeploymentController.php


注:本文中的StringHelper::encrypt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。