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


PHP Crypt_AES::setPassword方法代码示例

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


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

示例1: create_message

 public function create_message(model\api_message $message)
 {
     $payload = serialize($message);
     $key = $this->key;
     $salt = crypt(microtime() . mt_rand(0, mt_getrandmax()));
     $cipher = new \Crypt_AES(CRYPT_AES_MODE_ECB);
     $cipher->setPassword($key, 'pbkdf2', 'sha256', $salt, 1000);
     $payload_enc = $cipher->encrypt($payload);
     $message = base64_encode(serialize(array('s' => $salt, 'p' => $payload_enc, 't' => @gmmktime())));
     return $message;
 }
开发者ID:SkyFire-Lee,项目名称:x7chat,代码行数:11,代码来源:api.php

示例2: decrypt

 public static function decrypt($secret, $password, ApiKeyEncryptionOptions $options)
 {
     $decodedSecret = self::base64url_decode($secret);
     $salt = self::base64url_decode($options->getEncryptionKeySalt());
     $iterations = $options->getEncryptionKeyIterations();
     $keyLengthBits = $options->getEncryptionKeySize();
     $iv = substr($decodedSecret, 0, 16);
     $aes = new \Crypt_AES();
     $aes->setPassword($password, 'pbkdf2', 'sha1', $salt, $iterations, $keyLengthBits / 8);
     $aes->setKeyLength($keyLengthBits);
     $aes->setIV($iv);
     return $aes->decrypt(substr($decodedSecret, 16));
 }
开发者ID:InfinityCCS,项目名称:stormpath-sdk-php,代码行数:13,代码来源:ApiKeyEncryptionUtils.php

示例3: auth_decrypt

/**
 * Decrypt the given AES ciphertext
 *
 * The mode is CBC, the key is derived using pbkdf2
 *
 * @param string $ciphertext The encrypted data
 * @param string $secret     The secret/password that shall be used
 * @return string The decrypted data
 */
function auth_decrypt($ciphertext, $secret)
{
    $iv = substr($ciphertext, 0, 16);
    $cipher = new Crypt_AES();
    $cipher->setPassword($secret);
    $cipher->setIV($iv);
    return $cipher->decrypt(substr($ciphertext, 16));
}
开发者ID:amondot,项目名称:dokuwiki_ynh,代码行数:17,代码来源:auth.php

示例4: decryptFile

 function decryptFile($filename, $key)
 {
     include_once CL_ROOT . "/include/phpseclib/Crypt/AES.php";
     $cipher = new Crypt_AES();
     // could use CRYPT_AES_MODE_CBC
     $cipher->setPassword($key);
     $ciphertext = file_get_contents($filename);
     //echo $cipher->decrypt($cipher->encrypt($plaintext));
     return $cipher->decrypt($ciphertext);
 }
开发者ID:Setrino,项目名称:collabtive,代码行数:10,代码来源:class.datei.php

示例5: header

<?php

session_start();
if ($_SESSION["autentificado"]) {
    include 'Crypt/AES.php';
    $cipher = new Crypt_AES(CRYPT_AES_MODE_ECB);
    $cipher->setPassword('whatever');
    $menu1 = $_SESSION['username'];
    $hostname = '{mx1.hostinger.mx:143/imap}INBOX';
    $username = $_SESSION['email'];
    $password = $_SESSION['pwemail'];
    $inbox = imap_open($hostname, $username, $password);
    $emails = imap_search($inbox, 'SUBJECT "BlueTurtle"');
} else {
    header("Location:index.php");
}
?>
<!DOCTYPE html>
<html lang="es-MX">
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<link href="src/faviconbt.ico" rel="icon" type="image/x-icon" />
		<title>BlueTurtle</title>
		<!-- Bootstrap CSS -->
		<link href="css/bootstrap.css" rel="stylesheet">
		<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
		<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
		<!--[if lt IE 9]>
			<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
开发者ID:XolotSoft,项目名称:BlueTurtle,代码行数:31,代码来源:mensaje.php

示例6: header

<?php

session_start();
if ($_SESSION["autentificado"]) {
    $menu1 = $_SESSION['username'];
    include 'Crypt/AES.php';
    $cipher = new Crypt_AES(CRYPT_AES_MODE_ECB);
    $cipher->setPassword($_POST['pass']);
    $menu1 = $_SESSION['username'];
    $hostname = '{mx1.hostinger.mx:143/imap}INBOX';
    $username = $_SESSION['email'];
    $password = $_SESSION['pwemail'];
    $inbox = imap_open($hostname, $username, $password);
    $emails = imap_search($inbox, 'SUBJECT "BlueTurtle"');
} else {
    header("Location:index.php");
}
?>
<!DOCTYPE html>
<html lang="es-MX">
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<link href="src/faviconbt.ico" rel="icon" type="image/x-icon" />
		<title>BlueTurtle</title>
		<!-- Bootstrap CSS -->
		<link href="css/bootstrap.css" rel="stylesheet">
		<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
		<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
		<!--[if lt IE 9]>
开发者ID:XolotSoft,项目名称:BlueTurtle,代码行数:31,代码来源:mensajec.php

示例7: time

<?php

session_start();
$tokenNac = time() - $_SESSION['tokenNac'];
if (isset($_SESSION['token'])) {
    if ($_POST['token'] === $_SESSION['token']) {
        if ($tokenNac >= 5) {
            if ($_SESSION["autentificado"]) {
                include '../Crypt/AES.php';
                $cipher = new Crypt_AES(CRYPT_AES_MODE_ECB);
                $tipo = $_POST['tipo'];
                $para = $_POST['email'];
                $asunto = "BlueTurtle" . $tipo . $_SESSION['username'];
                if ($tipo == 'passwd') {
                    if ($_POST['palCla'] == $_POST['conPal']) {
                        $cipher->setPassword($_POST['palCla']);
                        $mensaje = base64_encode($cipher->encrypt($_POST['mensaje']));
                        $mensaje = wordwrap($mensaje, 70, "\r\n");
                        @mail($para, $asunto, $mensaje);
                        echo "<script>alert('El mensaje se envio correctamente');\n\t\t\t\t\t\t\tlocation.href='../EnvioRapido.php';\n\t\t\t\t\t\t\t</script>";
                    } else {
                        header('Location:../index.php');
                    }
                }
                if ($tipo == 'basica') {
                    $cipher->setPassword('whatever');
                    $mensaje = base64_encode($cipher->encrypt($_POST['mensaje']));
                    $mensaje = wordwrap($mensaje, 70, "\r\n");
                    @mail($para, $asunto, $mensaje);
                    echo "<script>alert('El mensaje se envio correctamente');\n\t\t\t\t\t\tlocation.href='../EnvioRapido.php';\n\t\t\t\t\t\t</script>";
                }
开发者ID:XolotSoft,项目名称:BlueTurtle,代码行数:31,代码来源:enviar.php


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