php - json_decode returns NULL on string that has passed through encryption -
I'm trying to secure information on its database and is the standard type of data JSON and I have some simple I have a valid JSON string and I tested I'm just now debugging it in a simple script: I verify the output of is UPDATE bin2hex reads: This means that you Dulripted Let's emulate NUL bytes in the string. This happens because In your AS you can get away with the application after decryption . Or more at all: Mcrypt function that encrypts any text and decrypt, they are:
function encrypt ($ key, $ data) {$ encrypted_data = mcrypt_cbc (MCRYPT_RIJNDAEL_192, $ Key, $ data, MCRYPT_ENCRYPT); Return base64_encode ($ encrypted_data); } Function decrypt ($ key, $ Ankripteddeta) {$ decrypt = mcrypt_cbc (MCRYPT_RIJNDAEL_192, the $, Base64_decode ($ Ankripteddeta), MCRYPT_DECRYPT); Return $ decrypt; }
json_decode without passing through encryption, and so am but when I encrypt it works It tries to decrypt then to
json_decode , it only returns
NULL .
Include ("coreFunctions.php"); $ Arr = '{"number": "4646464646", "type": "home"}'; $ Key = "Ladida"; $ Lock = encrypt ($ key, $ arr); Var_dump ($ closed); Var_dump (json_decode (decrypt ($ key, $ lock), true));
decrypt same as if it was inside.
I have discovered the strlen () before and after the difference. So how can I make sure that it remains the same during the encryption process or after that it can fix it? "post-text" itemprop = "text">
033303539222c2274797065223a22686f6d65227d00000000000000000000 mcrybt_cbc operates block-wise. To do this, it must fill input and output in multiples of 16 or (24) bytes. (The output may sometimes waste; therefore, a length field often adds to the encryption schemes / container formats.)
json_decode (rtrim (decrypt ($ key, $ lock), "\ 0"), true);
Comments
Post a Comment