0

I have applied AE on a SQL Server database at column with datatype of numeric(18,0). When I encrypt the data using SSMS the encryption of 154 is

0x01FA3FADE537BB5405E193F859FEDFBBC15C8177AB22F11B139AAB05158F685A29AED638E828BA43457C58668DC05D3DEC8612C28E7221F31BE8E4B291A1408972F186E456038E1041F376370147BCBB54

and I push 154 using JDBC Driver the encryption is

0x01D33F20C4A164160862CDD161305016053C166D4474FD21DA216C353049A8BEFC3EFE177E8FE7CD74E3BC7343D2EC51F7A8DECBD5C31E2F969A0A75D20EFCD7BC4AE0B59708971CF8EAC8C0A450ADA450

I am using a deterministic algorithm.

Because of this I am not able to apply where clause using JDBC. It return only those row which were pushed using JDBC after encryption.

Is there something I can fix to match both the encrypted values?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Amit Kumar
  • 21
  • 3
  • What does your Java code look like? Are you using the `setBigDecimal` overloads that include the `precision` and `scale` parameters? – AlwaysLearning Oct 20 '22 at 04:58
  • Yes. I am using setBigDecmial(paramIndex, value, 18, 6); – Amit Kumar Oct 20 '22 at 10:31
  • Do you think that could be your problem? The column data type is `numeric(18,0)` so to match it have you tried using `setBigDecmial(paramIndex, value, 18, 0);`? – AlwaysLearning Oct 20 '22 at 11:07
  • I found the problem. SSMS is using Dotnet lib to encrypt the data and java using java based. So if we push the data in encrypted Numeric columns encryption will be different for same plain text. For example : Plain Text || Java based Encryption || Dot Net Based Encryption ABC ||| 0xabasdfjkerwkjljasdkfjl ||| 0xerwersdfasdfasdfasdfs – Amit Kumar Nov 07 '22 at 11:44

0 Answers0