/** * Get decrypted token * @param string $str Encoded token * @return Array Token data array */ public function getTokenDecrypt($str) { // Old method $token = $this->ednaoCrypt->decrypt(urldecode($str)); if (!$token) { // New method $token = $this->ednaoCrypt->decrypt($str); } return Token::unserialize($token); }
public function testCryptDecrypt() { $str = 'Ceci est un test hyper important !!'; $ec = new EdnaoCryptography(); $encoded = $ec->crypt($str); $decoded = $ec->decrypt($encoded); $this->assertNotEmpty($encoded); $this->assertEquals($str, $decoded); }