PHP Класс ParagonIE\PasswordLock\PasswordLock

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

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

Метод Описание
decryptAndVerify ( string $password, string $ciphertext, Defuse\Crypto\Key $aesKey ) : boolean 1. VerifyHMAC-then-Decrypt the ciphertext to get the hash 2. Verify that the password matches the hash
decryptAndVerifyLegacy ( string $password, string $ciphertext, string $aesKey ) : boolean 1. VerifyHMAC-then-Decrypt the ciphertext to get the hash 2. Verify that the password matches the hash
hashAndEncrypt ( string $password, Defuse\Crypto\Key $aesKey ) : string 1. Hash password using bcrypt-base64-SHA256 2. Encrypt-then-MAC the hash
rotateKey ( string $ciphertext, Defuse\Crypto\Key $oldKey, Defuse\Crypto\Key $newKey ) : string Key rotation method -- decrypt with your old key then re-encrypt with your new key
upgradeFromVersion1 ( string $password, string $ciphertext, string $oldKey, Defuse\Crypto\Key $newKey ) : string For migrating from an older version of the library

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

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

1. VerifyHMAC-then-Decrypt the ciphertext to get the hash 2. Verify that the password matches the hash
public static decryptAndVerify ( string $password, string $ciphertext, Defuse\Crypto\Key $aesKey ) : boolean
$password string
$ciphertext string
$aesKey Defuse\Crypto\Key
Результат boolean

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

1. VerifyHMAC-then-Decrypt the ciphertext to get the hash 2. Verify that the password matches the hash
public static decryptAndVerifyLegacy ( string $password, string $ciphertext, string $aesKey ) : boolean
$password string
$ciphertext string
$aesKey string - must be exactly 16 bytes
Результат boolean

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

1. Hash password using bcrypt-base64-SHA256 2. Encrypt-then-MAC the hash
public static hashAndEncrypt ( string $password, Defuse\Crypto\Key $aesKey ) : string
$password string
$aesKey Defuse\Crypto\Key
Результат string

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

Key rotation method -- decrypt with your old key then re-encrypt with your new key
public static rotateKey ( string $ciphertext, Defuse\Crypto\Key $oldKey, Defuse\Crypto\Key $newKey ) : string
$ciphertext string
$oldKey Defuse\Crypto\Key
$newKey Defuse\Crypto\Key
Результат string

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

For migrating from an older version of the library
public static upgradeFromVersion1 ( string $password, string $ciphertext, string $oldKey, Defuse\Crypto\Key $newKey ) : string
$password string
$ciphertext string
$oldKey string
$newKey Defuse\Crypto\Key
Результат string