hsqldbhypersql

HSQL DB function to decrypt AES value


I have an HSQL database. It has a table with a particular column which has AES encrypted values. What I need is decrypt those values using an HSQL function. In MySQL it has function aes_decrypt('encrypted_value', key). So, using MySQL I can run following query select AES_DECRYPT('7FCDjrd8nHPKOQgb7bzskQ', 'TheBestSecretKey') to get my work done.

Anyone knows an alternative for this in HSQL DB.


Solution

  • There is no equivalent function in HSQLDB. But you can define your version of aes_decrypt in Java and and use CREATE FUNCTION in HSQLDB to link to your java code. You need to find out exactly what MySQL does during encryption and decryption and apply it to your own function.