ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

Why is encryption restricted to 215 chars?

Open RafaelKoch opened this issue 6 years ago • 4 comments

This method accepts an unspecified number of chars but does in fact limit the encrypted string to 215 chars.

https://github.com/microsoft/ALAppExtensions/blob/457a4cef2813d12e7feedcdec9ebf05cd9da4eac/Modules/System/Cryptography%20Management/src/CryptographyManagementImpl.Codeunit.al#L26

As documented here: https://docs.microsoft.com/en-us/dynamics-nav/encrypt

This is hard to implement in a reliable way. Overflows depend on the composition of the input string. So in reality problems arise at runtime. I would like to understand the reasoning behind the restriction.

An idea has also been posted in parallel: https://experience.dynamics.com/ideas/idea/?ideaid=17e7f6b2-6651-ea11-b698-0003ff68a0f4

RafaelKoch avatar Feb 17 '20 11:02 RafaelKoch

@JesperSchulz

AlexanderYakunin avatar Feb 17 '20 14:02 AlexanderYakunin

@SBalslev

PaulIvan avatar Feb 18 '20 15:02 PaulIvan

The encryption feature in Business Central was designed to store passwords and credit cards encrypted so any backup (data at rest) had additonal protection. It is not intended to be used to encrypt large amounts of data and does not support it.

If we need to support larger amounts of data a new algorithem is needed and this might be done best by using an external data store, ex. like Azure KeyVault.

SBalslev avatar Feb 20 '20 10:02 SBalslev

@RafaelKoch We have recently added support for AES in Business Central so you could try and see if that suits your needs but keep in mind that it requires the user to handle the encryption keys themselves.

https://github.com/microsoft/ALAppExtensions/tree/master/Modules/System/Cryptography%20Management#rijndael-cryptography-codeunit-1258

PaulIvan avatar Feb 20 '20 10:02 PaulIvan