本文整理汇总了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();
}
示例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]]));
}