PHP 클래스 Phalcon\Legacy\Crypt

Port of Phalcon 2.0.x Phalcon\Crypt. Provides encryption facilities to phalcon applications. $crypt = new \Phalcon\Legacy\Crypt(); $key = 'le password'; $text = 'This is a secret text'; $encrypted = $crypt->encrypt($text, $key); echo $crypt->decrypt($encrypted, $key);
상속: implements Phalcon\Legacy\CryptInterface
파일 보기 프로젝트 열기: phalcon/incubator 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$cipher
$key
$mode
$padding

공개 메소드들

메소드 설명
decrypt ( string $text, string $key = null ) : string Decrypts a text
decryptBase64 ( string $text, mixed $key = null, boolean $safe = false ) : string Decrypt a text that is coded as a base64 string
encrypt ( string $text, mixed $key = null ) : string Encrypts a text
encryptBase64 ( string $text, mixed $key = null, boolean $safe = false ) : string Encrypts a text returning the result as a base64 string
getAvailableCiphers ( ) : array Returns a list of available cyphers
getAvailableModes ( ) : array Returns a list of available modes
getCipher ( ) : string Returns the current cipher
getKey ( ) : string Returns the encryption key
getMode ( ) : string Returns the current encryption mode
setCipher ( string $cipher ) : Phalcon\Legacy\CryptInterface
setKey ( string $key ) : Phalcon\Legacy\CryptInterface Sets the encryption key
setMode ( string $mode ) : Phalcon\Legacy\CryptInterface Sets the encrypt/decrypt mode
setPadding ( integer $scheme ) : Phalcon\Legacy\CryptInterface Changes the padding scheme used

보호된 메소드들

메소드 설명
cryptPadText ( string $text, string $mode, integer $blockSize, integer $paddingType ) : string Pads texts before encryption
cryptUnpadText ( string $text, string $mode, integer $blockSize, integer $paddingType ) : string Removes $paddingType padding from text If the function detects that the text was not padded, it will return it unmodified

메소드 상세

cryptPadText() 보호된 메소드

Pads texts before encryption
protected cryptPadText ( string $text, string $mode, integer $blockSize, integer $paddingType ) : string
$text string
$mode string
$blockSize integer
$paddingType integer
리턴 string

cryptUnpadText() 보호된 메소드

Removes $paddingType padding from text If the function detects that the text was not padded, it will return it unmodified
protected cryptUnpadText ( string $text, string $mode, integer $blockSize, integer $paddingType ) : string
$text string Message to be unpadded
$mode string Encryption mode; unpadding is applied only in CBC or ECB mode
$blockSize integer Cipher block size
$paddingType integer Padding scheme
리턴 string

decrypt() 공개 메소드

echo $crypt->decrypt($encrypted, "decrypt password");
public decrypt ( string $text, string $key = null ) : string
$text string
$key string
리턴 string

decryptBase64() 공개 메소드

Decrypt a text that is coded as a base64 string
public decryptBase64 ( string $text, mixed $key = null, boolean $safe = false ) : string
$text string
$key mixed
$safe boolean
리턴 string

encrypt() 공개 메소드

$encrypted = $crypt->encrypt("Ultra-secret text", "encrypt password");
public encrypt ( string $text, mixed $key = null ) : string
$text string
$key mixed
리턴 string

encryptBase64() 공개 메소드

Encrypts a text returning the result as a base64 string
public encryptBase64 ( string $text, mixed $key = null, boolean $safe = false ) : string
$text string
$key mixed
$safe boolean
리턴 string

getAvailableCiphers() 공개 메소드

Returns a list of available cyphers
public getAvailableCiphers ( ) : array
리턴 array

getAvailableModes() 공개 메소드

Returns a list of available modes
public getAvailableModes ( ) : array
리턴 array

getCipher() 공개 메소드

Returns the current cipher
public getCipher ( ) : string
리턴 string

getKey() 공개 메소드

Returns the encryption key
public getKey ( ) : string
리턴 string

getMode() 공개 메소드

Returns the current encryption mode
public getMode ( ) : string
리턴 string

setCipher() 공개 메소드

public setCipher ( string $cipher ) : Phalcon\Legacy\CryptInterface
$cipher string
리턴 Phalcon\Legacy\CryptInterface

setKey() 공개 메소드

Sets the encryption key
public setKey ( string $key ) : Phalcon\Legacy\CryptInterface
$key string
리턴 Phalcon\Legacy\CryptInterface

setMode() 공개 메소드

Sets the encrypt/decrypt mode
public setMode ( string $mode ) : Phalcon\Legacy\CryptInterface
$mode string
리턴 Phalcon\Legacy\CryptInterface

setPadding() 공개 메소드

Changes the padding scheme used
public setPadding ( integer $scheme ) : Phalcon\Legacy\CryptInterface
$scheme integer
리턴 Phalcon\Legacy\CryptInterface

프로퍼티 상세

$cipher 보호되어 있는 프로퍼티

protected $cipher

$key 보호되어 있는 프로퍼티

protected $key

$mode 보호되어 있는 프로퍼티

protected $mode

$padding 보호되어 있는 프로퍼티

protected $padding