PHP Класс Defuse\Crypto\Crypto

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
decrypt ( string $ciphertext, Defuse\Crypto\Key $key, boolean $raw_binary = false ) : string Decrypts a ciphertext to a string with a Key.
decryptWithPassword ( string $ciphertext, string $password, boolean $raw_binary = false ) : string Decrypts a ciphertext to a string with a password, using a slow key derivation function to make password cracking more expensive.
encrypt ( string $plaintext, Defuse\Crypto\Key $key, boolean $raw_binary = false ) : string Encrypts a string with a Key.
encryptWithPassword ( string $plaintext, string $password, boolean $raw_binary = false ) : string Encrypts a string with a password, using a slow key derivation function to make password cracking more expensive.
legacyDecrypt ( string $ciphertext, string $key ) : string Decrypts a legacy ciphertext produced by version 1 of this library.

Защищенные методы

Метод Описание
plainDecrypt ( string $ciphertext, string $key, string $iv, string $cipherMethod ) : string Raw unauthenticated decryption (insecure on its own).
plainEncrypt ( string $plaintext, string $key, string $iv ) : string Raw unauthenticated encryption (insecure on its own).
verifyHMAC ( string $correct_hmac, string $message, string $key ) : boolean Verifies an HMAC without leaking information through side-channels.

Приватные методы

Метод Описание
decryptInternal ( string $ciphertext, KeyOrPassword $secret, boolean $raw_binary ) : string Decrypts a ciphertext to a string with either a key or a password.
encryptInternal ( string $plaintext, KeyOrPassword $secret, boolean $raw_binary ) : string Encrypts a string with either a key or a password.

Описание методов

decrypt() публичный статический Метод

Decrypts a ciphertext to a string with a Key.
public static decrypt ( string $ciphertext, Defuse\Crypto\Key $key, boolean $raw_binary = false ) : string
$ciphertext string
$key Defuse\Crypto\Key
$raw_binary boolean
Результат string

decryptWithPassword() публичный статический Метод

Decrypts a ciphertext to a string with a password, using a slow key derivation function to make password cracking more expensive.
public static decryptWithPassword ( string $ciphertext, string $password, boolean $raw_binary = false ) : string
$ciphertext string
$password string
$raw_binary boolean
Результат string

encrypt() публичный статический Метод

Encrypts a string with a Key.
public static encrypt ( string $plaintext, Defuse\Crypto\Key $key, boolean $raw_binary = false ) : string
$plaintext string
$key Defuse\Crypto\Key
$raw_binary boolean
Результат string

encryptWithPassword() публичный статический Метод

Encrypts a string with a password, using a slow key derivation function to make password cracking more expensive.
public static encryptWithPassword ( string $plaintext, string $password, boolean $raw_binary = false ) : string
$plaintext string
$password string
$raw_binary boolean
Результат string

legacyDecrypt() публичный статический Метод

Decrypts a legacy ciphertext produced by version 1 of this library.
public static legacyDecrypt ( string $ciphertext, string $key ) : string
$ciphertext string
$key string
Результат string

plainDecrypt() защищенный статический Метод

Raw unauthenticated decryption (insecure on its own).
protected static plainDecrypt ( string $ciphertext, string $key, string $iv, string $cipherMethod ) : string
$ciphertext string
$key string
$iv string
$cipherMethod string
Результат string

plainEncrypt() защищенный статический Метод

Raw unauthenticated encryption (insecure on its own).
protected static plainEncrypt ( string $plaintext, string $key, string $iv ) : string
$plaintext string
$key string
$iv string
Результат string

verifyHMAC() защищенный статический Метод

Verifies an HMAC without leaking information through side-channels.
protected static verifyHMAC ( string $correct_hmac, string $message, string $key ) : boolean
$correct_hmac string
$message string
$key string
Результат boolean