TUniEncryptor: String or binary data would be truncated

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
FredS
Posts: 272
Joined: Mon 10 Nov 2014 17:52

TUniEncryptor: String or binary data would be truncated

Post by FredS » Wed 02 Mar 2016 19:13

Hi,

Added this to two fields yesterday in Firebird3 and no issues but with MS SQLServer I get this error.
Both Fields have been doubled in size and the actual data that causes this issue is minuscule.
Persistent Fields have been updated with new sizes.

Field1 nvarchar(160), string length before encryption is 8
Field2 nvarchar(320), string length before encryption is 14

EMSError with message 'The statement has been terminated.
String or binary data would be truncated.'

Clearing Encryption.Fields makes all work albeit without encryption..

I tried checking the encrypted data size with the Monitor but that displays plain data.

EDIT: It turns a 44 character string into +160 characters and that is with ehNone

FredS
Posts: 272
Joined: Mon 10 Nov 2014 17:52

Re: TUniEncryptor: String or binary data would be truncated

Post by FredS » Wed 02 Mar 2016 21:36

Turns out varchar(80) needs varchar(500) when encrypted, actually 432.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: TUniEncryptor: String or binary data would be truncated

Post by AlexP » Fri 04 Mar 2016 11:35

Hello,

When using encryption, the size of the data written to the database is greater than the really inserted data. This is due to the fact that, additional information is written to the database together with the encrypted data. Also, because different algorithms use different minimal length of data blocks.

Post Reply