on ‎2020 Mar 24 12:21 AM
Hello Experts ,
Though my query is basically to know if exception "Cesu8ConversionException Invalid CESU-8 sequence" can be handled in custom HANA scalar functions, I wanted to provide a context to my problem first (Apologies for the long explanation).
We have a requirement for Encryption / Decryption at Table Column level. Since HANA does not support Table-Column Level encryption, neither any built-in functions , I planned to work on a prototype by creating custom logic in my own scalar function at HANA DB level.
I referenced the blog for getting some directions : https://blogs.sap.com/2017/10/07/column-encryption-decryption-on-hana/#
Now I was able to build my simple encryption function by using the below high level logic.
Encryption: (Input = string data to be encrypted, Passkey = secure key for encryption/decryption ) - Example SAM_DO_ENCRYPT('Hello','MyKey')
Now, when I do decryption I simply pass the passkey and generate the Hash-key(B), which I do the X-OR with my saved encrypted value of (C). This would be giving me the binary data(A) of my original input and I can convert to string (No issue in conversion here as this binary data was for the unicode compliant input ). And this works fine when I pass the right pass key.
But if pass a wrong key(eg: 'My123' instead of 'MyKey'), the chances are the BitXOR(of C and B) would result binary representation of some non-unicode compliant characters. So when I try to convert this to string, it gives me the error "Cesu8ConversionException Invalid CESU-8 sequence". I want to avoid this error, by say, handling via Exit Handler in my scalar function.
If I add the below code in my scalar function, it says "feature not supported: The error code is not allowed in handler"
DECLARE EXIT HANDLER FOR SQL_ERROR_CODE 609 --Error code CESU-Invalid 8
BEGIN
--ex_decrypted_data = 'Test';
END;
Your inputs are very much needed here.
Regards,
Samson
Request clarification before answering.
| User | Count |
|---|---|
| 5 | |
| 5 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.