createFromPassword() public static method

Initializes an instance of KeyOrPassword from a password.
public static createFromPassword ( string $password ) : KeyOrPassword
$password string
return KeyOrPassword
Ejemplo n.º 1
0
 /**
  * Decrypts a ciphertext to a string with a password, using a slow key
  * derivation function to make password cracking more expensive.
  *
  * @param string $ciphertext
  * @param string $password
  * @param bool   $raw_binary
  *
  * @throws Ex\EnvironmentIsBrokenException
  * @throws Ex\WrongKeyOrModifiedCiphertextException
  *
  * @return string
  */
 public static function decryptWithPassword($ciphertext, $password, $raw_binary = false)
 {
     return self::decryptInternal($ciphertext, KeyOrPassword::createFromPassword($password), $raw_binary);
 }
Ejemplo n.º 2
0
 /**
  * Decrypts the contents of one resource into another with a password, using
  * a slow key derivation function to make password cracking more expensive.
  *
  * @param resource $inputHandle
  * @param resource $outputHandle
  * @param string   $password
  *
  * @throws Defuse\Crypto\Exception\EnvironmentIsBrokenException
  * @throws Defuse\Crypto\Exception\IOException
  * @throws Defuse\Crypto\Exception\WrongKeyOrModifiedCiphertextException
  */
 public static function decryptResourceWithPassword($inputHandle, $outputHandle, $password)
 {
     self::decryptResourceInternal($inputHandle, $outputHandle, KeyOrPassword::createFromPassword($password));
 }