Hi Guys,
Just wanted to know if anyone has an idea how to do this:
I need encryption ability on information going into the database, but then I also need to decrypt it as well if an admin or the user needs to change any information.
I’ve tried SALT but this can’t be decrypted (so I’ve found out)
Do any one have any ideas, as I’ve hit a brick wall on this
Hi Peter,
Hashing with salt is a one-way function and it cannot be decrypted. That's why this type of encryption is used for storing passwords - you cannot decrypt them, you just compare hashes.
I believe there are ways of doing this but it will need some custom code. Here is a useful reference to using openssl encryption/ decryption in PHP which may help
Actually, looking into what wappler has to offer, i see there is “Encrypt with password” and “Decrypt with password” in the Crytographic options, have you tried them?
no, not yet, that might be a work around and use their login password.
Good call I’ll have a look into that, lol back to long days and late night web designing
I used Mcrypt in a PHP/MySQL project a few years ago, but it was removed in PHP 7.2. There is an alternative - Sodium - but I haven’ t used it. I don’t think it would be a trivial matter to use this with Wappler. Perhaps not possible at all.
I would be interested to know more about the encrypt/decrypt options @Hyperbytes mentioned.
I think it’s using Mcrypt - in which case I don’t think it will work with PHP 7.2. If this correct, it would be good to know if this feature will be updated.
I think it was deprecated pre-7.2 and finally removed in that version. So - probably not a good idea to use it. I hope there will be a replacement at some point.
This is indeed something that needs to be updated, but have to be careful not to break current implementation since openssl encryption is different then the mcrypt encryption.
That will probably be the solution if we don’t find a way to decrypt the old mcrypt encrypted data, but prefer to just replace the old with the new encryption. Will do some tests, there are a lot of encryption methods in openssl, probably one is compatible with the old mcrypt.
Encrypt your data as required to the DB, to display use a repeater with a setvalue step inside the server action calling the data. Apply decrypt to the setvalue step and then on the page bind it, the data will then be displayed decrypted.
Hi Dave
The issue is not how to do it mechanically, the issue is which cryptographic method to use which is compatible with all versions of PHP. The inbuilt encrypt/decrypt with password doesn’t work after php v7.0