JReviews Posted November 18, 2020 Posted November 18, 2020 Hi I have a plugin that uses the IPS\Text\Encrypt class descrypt and encrypt methods to store client login data. After moving to a new server the data can no longer be decrypted. Is is possible to transfer the encryption key to the new server to allow this to continue working? Thanks
DawPi Posted November 18, 2020 Posted November 18, 2020 If you moved to another host you probably changed your sql database details. So, look: /** * Get Key * * @return void */ public static function key() { return \IPS\TEXT_ENCRYPTION_KEY ?: md5( \IPS\Settings::i()->sql_pass . \IPS\Settings::i()->sql_database ); } It won't work due to this.
CoffeeCake Posted November 18, 2020 Posted November 18, 2020 Wait... so encrypted data ceases to be accessible if you do something standard like rotate service account passwords? 😵 Why isn't there a constant that's used as an encryption key just for this purpose so that the password can be changed without affecting anything else?
Solution Stuart Silvester Posted November 18, 2020 Solution Posted November 18, 2020 Just now, Paul E. said: Wait... so encrypted data ceases to be accessible if you do something standard like rotate service account passwords? 😵 Why isn't there a constant that's used as an encryption key just for this purpose so that the password can be changed without affecting anything else? There is a constant ( TEXT_ENCRYPTION_KEY ) that you can set if you change your credentials. If you already have encrypted text stored, you would need to calculate the same MD5 and then save it to constants.php CoffeeCake 1
JReviews Posted November 18, 2020 Author Posted November 18, 2020 That's great news. Since I didn't know that, I actually created a hook to override the key method 😉Â
JReviews Posted November 18, 2020 Author Posted November 18, 2020 You are right, but it wasn't clear to me straightaway from the code you shared. Should have taken a few more minutes to read it 😉Â
Recommended Posts