PHP Class Defuse\Crypto\KeyOrPassword

显示文件 Open project: defuse/php-encryption Class Usage Examples

Public Methods

Method Description
createFromKey ( Defuse\Crypto\Key $key ) : KeyOrPassword Initializes an instance of KeyOrPassword from a key.
createFromPassword ( string $password ) : KeyOrPassword Initializes an instance of KeyOrPassword from a password.
deriveKeys ( string $salt ) : Defuse\Crypto\DerivedKeys Derives authentication and encryption keys from the secret, using a slow key derivation function if the secret is a password.

Private Methods

Method Description
__construct ( integer $secret_type, mixed $secret ) Constructor for KeyOrPassword.

Method Details

createFromKey() public static method

Initializes an instance of KeyOrPassword from a key.
public static createFromKey ( Defuse\Crypto\Key $key ) : KeyOrPassword
$key Defuse\Crypto\Key
return KeyOrPassword

createFromPassword() public static method

Initializes an instance of KeyOrPassword from a password.
public static createFromPassword ( string $password ) : KeyOrPassword
$password string
return KeyOrPassword

deriveKeys() public method

Derives authentication and encryption keys from the secret, using a slow key derivation function if the secret is a password.
public deriveKeys ( string $salt ) : Defuse\Crypto\DerivedKeys
$salt string
return Defuse\Crypto\DerivedKeys