$string = 'This is a string'; $encoded = Crypt::encode($string); $decoded = Crypt::decode($encoded); if ($decoded !== $string) echo "Does this happen?";
public function encryptApiKey($api_key){ $value = Crypt::encode($api_key, false); return $value; } public function decryptApiKey($api_key){ $value = Crypt::decode($api_key, false); return $value; }
public function action_crypt() { $x = 'This is a string This is a string This is a string This is a string This is a string This is a string This is a string This is a string'; var_dump($x = $this->encryptApiKey($x)); var_dump($x = $this->decryptApiKey($x)); $this->response->body = '<br /><br /><hr />TEST CONTROLLER - CRYPT METHOD'; }This encrypts and decrypts fine. I think your problems are elsewhere. Are you sure the $api_key is the same in both cases? No issue with storing it, no corruption when getting is from the client (if applicable)?
It looks like you're new here. If you want to get involved, click one of these buttons!