Skip to content

[Bug]: Support binary-safe AES encryption/decryption in AL #5338

@AlbertSanocki

Description

@AlbertSanocki

Describe the issue

We need to introduce support for AES encryption and decryption in AL that works directly with binary data.
Currently, the built-in Rijndael Cryptography codeunit only handles text-based operations. This makes it unsuitable for scenarios where files are encrypted or decrypted in binary form, such as .zip or .pdf files.
When encrypting or decrypting binary files using the existing Rijndael Cryptography codeunit, the Decrypt method outputs a Text value.
As a result, decrypted binary data (e.g., .zip contents) is assigned to a Text variable, corrupting the output file and making it unusable.

Expected behavior

Supporting AES operations that work with binary data (via Base64 or TempBlob) would allow developers to safely encrypt and decrypt files of any type without data loss.

Steps to reproduce

Add new methods in the Rijndael Cryptography codeunit (or create a new AES Cryptography codeunit) that:
Accept and return Base64-encoded strings or TempBlob data.
Support both AES encryption and decryption.
Maintain backward compatibility with existing text-based methods.
Ensure proper error handling for invalid input formats.

Additional context

No response

I will provide a fix for a bug

  • I will provide a fix for a bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions