Encrypt/Decrypt Confusion - Blank Decrypts |
New to Encrypt/Decrypt in CI4. Having a strange issue where doing an encrypt/decrypt as a test on the view page works as expected. But if I save the encrypted data into my MySQL table (varchar 255 column), when I decrypt the data, it comes back blank. Looking for any pointers or a fresh set of eyes to point out my mistake.
On page (view) works: PHP Code: <?php Code: Original: 4444333322221111 But if I save the data to my table, like this: PHP Code: $post = $this->request->getPost(); and try to bring it back later in my controller with: PHP Code: $orig = $payment['cc_num']; I get: Code: Original: 2OklJexxXUZIK9uPGOHE//Bc9BIHoCc5BUD5KOva3pgCYkqyivIB+MJlbJJJSE6/5yxnf5H3h/zVhJtcCoMc8js/tq3674E4 So it appears to be saving correctly, but decrypting is returning an empty string. Any help is appreciated!
Is the original string the same on insert and output? That would be my first thought, inserting can seem to be looking ok but is it also correct.
(09-14-2021, 02:19 AM)superior Wrote: Is the original string the same on insert and output? That would be my first thought, inserting can seem to be looking ok but is it also correct. Thank you. Thank you!! Sometimes it takes a fresh set of eyes to point out the obvious! The "cleanCCNum" function wasn't returning what I thought it was returning (actually it wasn't returning anything!). Once I cleaned that up, it was all good. Thank you again. |
Welcome Guest, Not a member yet? Register Sign In |