Defuse\Crypto\KeyOrPassword::createFromKey PHP Method

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
    public static function createFromKey(Key $key)
    {
        return new KeyOrPassword(self::SECRET_TYPE_KEY, $key);
    }

Usage Example

コード例 #1
0
ファイル: Crypto.php プロジェクト: defuse/php-encryption
 /**
  * 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);
 }
All Usage Examples Of Defuse\Crypto\KeyOrPassword::createFromKey