← Back to Knowledge Base

KB #240047: Encrypted values in var char column are randomly decrypting incorrectly

⏱️ 2 min read
Type: Tip
Summary:
Values in a varchar column are, seemingly randomly, not decrypting to the proper plaintext value. This issue is associated with the TrimTrailingBlanks property for columns, or with programmatically trimming encrypted values.

 

Additional Information:
It is possible that a resulting encrypted value may contain a space (hex 20) at the end of the value. While this may not be significant for regular plaintext, it is a critical part of the encrypted value. If that value is trimmed then the encrypted value has changed and will not decrypt properly. The space may be trimmed programmatically using a Trim function, or automatically if the TrimTrailingBlanks property on the column is YES. This corrupted value will not decrypt to the original plain-text value.

The TrimTrailingBlanks property cannot be manually modified. But according to the following Microsoft KnowledgeBase article, the TrimTrailingBlanks property for a column is automatically set to NO if an ALTER COLUMN command is issued against the table in which the column exists.

KB296559: ALTER COLUMN Sets TrimTrailingBlanks Property to NO

The Encryptionizer Column Encryption API’s themselves do not automatically trim any values, nor do they have any control over the TrimTrailingBlanks property.

However, if using the Encryptionizer Column Encryption Manager (Col-E) to encrypt a column, the affected table is modified and the TrimTrailingBlanks property is set to NO

This only affects varchar fields and variables. nvarchar and varbinary are not affected.

Was this article helpful?

Related Articles

KB #240147: EKM client not retrieving key

Type: Information Summary: You have a service or application secured with an encryption key that…

KB #240146: This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms.

Type: Fixed. Summary: This issue has been addressed in Encryptionizer versions 2501.1.7.50217. If you have…

KB #240038: SQL database backups to a Mapped Drive are not encrypted

Type: Fixed This issue is resolved with Encryptionizer (x86) driver version 2008.401.4 or later. Summary:…

Still need help?

Our support team is here to assist you.

NetLib Security
AI Assistant · Online
Hi! I'm the NetLib Security assistant. I can answer questions about our encryption solutions, HIPAA compliance, Encryptionizer, and more. How can I help you today?