PHP 클래스 phpseclib\Crypt\TripleDES

저자: Jim Wigginton ([email protected])
상속: extends phpseclib\Crypt\DES
파일 보기 프로젝트 열기: phpseclib/phpseclib 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$cfb_init_len integer Optimizing value while CFB-encrypting
$cipher_name_mcrypt string The mcrypt specific name of the cipher
$des array Used only if $mode_3cbc === true
$key_length integer Key Length (in bytes)
$key_length_max string max possible size of $key
$mode_3cbc boolean Internal flag whether using self::MODE_3CBC or not
$password_default_salt string The default salt used by setPassword()

공개 메소드들

메소드 설명
__construct ( integer $mode ) Default Constructor.
_setupKey ( ) Creates the key schedule
decrypt ( string $ciphertext ) : string Decrypts a message.
disableContinuousBuffer ( ) Treat consecutive packets as if they are a discontinuous buffer.
enableContinuousBuffer ( ) Treat consecutive "packets" as if they are a continuous buffer.
encrypt ( string $plaintext ) : string Encrypts a message.
isValidEngine ( integer $engine ) : boolean Test for engine validity
setIV ( string $iv ) Sets the initialization vector.
setKey ( string $key ) Sets the key.
setKeyLength ( integer $length ) Sets the key length.
setPreferredEngine ( integer $engine ) : integer Sets the internal crypt engine

메소드 상세

__construct() 공개 메소드

Determines whether or not the mcrypt or OpenSSL extensions should be used. $mode could be: - \phpseclib\Crypt\Common\BlockCipher::MODE_ECB - \phpseclib\Crypt\Common\BlockCipher::MODE_CBC - \phpseclib\Crypt\Common\BlockCipher::MODE_CTR - \phpseclib\Crypt\Common\BlockCipher::MODE_CFB - \phpseclib\Crypt\Common\BlockCipher::MODE_OFB - \phpseclib\Crypt\TripleDES::MODE_3CB
또한 보기: phpseclib\Crypt\DES::__construct()
또한 보기: phpseclib\Crypt\Common\SymmetricKey::__construct()
public __construct ( integer $mode )
$mode integer

_setupKey() 공개 메소드

Creates the key schedule
또한 보기: phpseclib\Crypt\DES::_setupKey()
또한 보기: phpseclib\Crypt\Common\SymmetricKey::_setupKey()
public _setupKey ( )

decrypt() 공개 메소드

Decrypts a message.
또한 보기: phpseclib\Crypt\Common\SymmetricKey::decrypt()
public decrypt ( string $ciphertext ) : string
$ciphertext string
리턴 string $plaintext

disableContinuousBuffer() 공개 메소드

The default behavior.
또한 보기: phpseclib\Crypt\Common\SymmetricKey::disableContinuousBuffer()
또한 보기: self::enableContinuousBuffer()

enableContinuousBuffer() 공개 메소드

Say you have a 16-byte plaintext $plaintext. Using the default behavior, the two following code snippets will yield different outputs: echo $des->encrypt(substr($plaintext, 0, 8)); echo $des->encrypt(substr($plaintext, 8, 8)); echo $des->encrypt($plaintext); The solution is to enable the continuous buffer. Although this will resolve the above discrepancy, it creates another, as demonstrated with the following: $des->encrypt(substr($plaintext, 0, 8)); echo $des->decrypt($des->encrypt(substr($plaintext, 8, 8))); echo $des->decrypt($des->encrypt(substr($plaintext, 8, 8))); With the continuous buffer disabled, these would yield the same output. With it enabled, they yield different outputs. The reason is due to the fact that the initialization vector's change after every encryption / decryption round when the continuous buffer is enabled. When it's disabled, they remain constant. Put another way, when the continuous buffer is enabled, the state of the \phpseclib\Crypt\DES() object changes after each encryption / decryption round, whereas otherwise, it'd remain constant. For this reason, it's recommended that continuous buffers not be used. They do offer better security and are, in fact, sometimes required (SSH uses them), however, they are also less intuitive and more likely to cause you problems.
또한 보기: phpseclib\Crypt\Common\SymmetricKey::enableContinuousBuffer()
또한 보기: self::disableContinuousBuffer()

encrypt() 공개 메소드

Encrypts a message.
또한 보기: phpseclib\Crypt\Common\SymmetricKey::encrypt()
public encrypt ( string $plaintext ) : string
$plaintext string
리턴 string $cipertext

isValidEngine() 공개 메소드

This is mainly just a wrapper to set things up for \phpseclib\Crypt\Common\SymmetricKey::isValidEngine()
또한 보기: phpseclib\Crypt\Common\SymmetricKey::__construct()
public isValidEngine ( integer $engine ) : boolean
$engine integer
리턴 boolean

setIV() 공개 메소드

SetIV is not required when \phpseclib\Crypt\Common\SymmetricKey::MODE_ECB is being used.
또한 보기: phpseclib\Crypt\Common\SymmetricKey::setIV()
public setIV ( string $iv )
$iv string

setKey() 공개 메소드

Triple DES can use 128-bit (eg. strlen($key) == 16) or 192-bit (eg. strlen($key) == 24) keys. DES also requires that every eighth bit be a parity bit, however, we'll ignore that.
또한 보기: phpseclib\Crypt\DES::setKey()
또한 보기: phpseclib\Crypt\Common\SymmetricKey::setKey()
public setKey ( string $key )
$key string

setKeyLength() 공개 메소드

Valid key lengths are 128 and 192 bits. If you want to use a 64-bit key use DES.php
public setKeyLength ( integer $length )
$length integer

setPreferredEngine() 공개 메소드

Sets the internal crypt engine
또한 보기: phpseclib\Crypt\Common\SymmetricKey::__construct()
또한 보기: phpseclib\Crypt\Common\SymmetricKey::setPreferredEngine()
public setPreferredEngine ( integer $engine ) : integer
$engine integer
리턴 integer

프로퍼티 상세

$cfb_init_len 공개적으로 프로퍼티

Optimizing value while CFB-encrypting
또한 보기: phpseclib\Crypt\Common\SymmetricKey::cfb_init_len
public int $cfb_init_len
리턴 integer

$cipher_name_mcrypt 공개적으로 프로퍼티

The mcrypt specific name of the cipher
또한 보기: phpseclib\Crypt\DES::cipher_name_mcrypt
또한 보기: phpseclib\Crypt\Common\SymmetricKey::cipher_name_mcrypt
public string $cipher_name_mcrypt
리턴 string

$des 공개적으로 프로퍼티

Used only if $mode_3cbc === true
public array $des
리턴 array

$key_length 공개적으로 프로퍼티

Key Length (in bytes)
또한 보기: phpseclib\Crypt\TripleDES::setKeyLength()
public int $key_length
리턴 integer

$key_length_max 공개적으로 프로퍼티

max possible size of $key
또한 보기: self::setKey()
또한 보기: phpseclib\Crypt\DES::setKey()
public string $key_length_max
리턴 string

$mode_3cbc 공개적으로 프로퍼티

Internal flag whether using self::MODE_3CBC or not
public bool $mode_3cbc
리턴 boolean

$password_default_salt 공개적으로 프로퍼티

The default salt used by setPassword()
또한 보기: phpseclib\Crypt\Common\SymmetricKey::password_default_salt
또한 보기: phpseclib\Crypt\Common\SymmetricKey::setPassword()
public string $password_default_salt
리턴 string