I'm trying to achieve below using Jooq library,
Currently I'm trying to do this using org.jooq.Converter
and org.jooq.meta.jaxb.ForcedType
But
org.jooq.RecordContext
in the CustomConverter class to get the secret keyLinks I'm referring to:
Update: In short this is what I'm trying to achieve through Jooq:
CREATE TABLE TESTCRYPT(
Id mediumint AUTO_INCREMENT,
Secret int NOT NULL,
encrypteddata BLOB,
PRIMARY KEY(Id)
);
INSERT INTO TESTCRYPT(Secret,encrypteddata) VALUE ('1234',AES_ENCRYPT('my-data','1234'));
SELECT Secret ,AES_DECRYPT(encrypteddata,Secret) from TESTCRYPT t ;
As of jOOQ 3.18, there isn't an out of the box feature for this sort of computation. I've created a feature request, as this isn't the first time someone was looking for it:
If you must encrypt / decrypt on the server side using SQL expressions, perhaps you can get away with the new experimental query object model traversal and replacement features.
The idea is that you:
Field<MyType>
by Field<byte[]>
using encryption in contexts where a bind variable is writtenField<MyType>
to decryption in contexts where a projection is madeAll of this seems much easier to achieve with a simple Converter
, if you can encrypt / decrypt on the client instead of the server.