Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted November 18, 20204 yr 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
November 18, 20204 yr 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.
November 18, 20204 yr 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?
November 18, 20204 yr Solution 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
November 18, 20204 yr Author That's great news. Since I didn't know that, I actually created a hook to override the key method 😉
November 18, 20204 yr Author 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 😉