Initializes an instance of KeyOrPassword from a key.
public static createFromKey ( Defuse\Crypto\Key $key ) : |
||
$key | Defuse\Crypto\Key | |
return |
/** * Decrypts a ciphertext to a string with a Key. * * @param string $ciphertext * @param Key $key * @param bool $raw_binary * * @throws Ex\EnvironmentIsBrokenException * @throws Ex\WrongKeyOrModifiedCiphertextException * * @return string */ public static function decrypt($ciphertext, Key $key, $raw_binary = false) { return self::decryptInternal($ciphertext, KeyOrPassword::createFromKey($key), $raw_binary); }
/** * Takes two resource handles and decrypts the contents of the first, * writing the plaintext into the second. * * @param resource $inputHandle * @param resource $outputHandle * @param Key $key * * @throws Defuse\Crypto\Exception\EnvironmentIsBrokenException * @throws Defuse\Crypto\Exception\IOException * @throws Defuse\Crypto\Exception\WrongKeyOrModifiedCiphertextException */ public static function decryptResource($inputHandle, $outputHandle, Key $key) { self::decryptResourceInternal($inputHandle, $outputHandle, KeyOrPassword::createFromKey($key)); }