/** * Encrypts the given $string using the $key variable as encryption key. * * @param string $string Raw string that should be encrypted. * @param string $key Security key used for encryption. * * @return string Encrypted key. */ public function encrypt($string, $key) { return $this->serviceInstance->encrypt($string, $key); }
public function testEncryptDecryptFail() { $crypt = new Crypt(); $encrypted = $crypt->encrypt('test string', 'some key'); $result = $crypt->decrypt($encrypted, 'wrong key'); $this->assertFalse($result); }