The Encryption Prescription: How to Enable Encryption in NAV 2015

In previous versions of NAV to encrypt sensitive data like passwords, credit cards, or social security numbers was a real pain. Now with the release of Microsoft Dynamics NAV 2015 you have Encryption capabilities built in. With the Encryption Management Codeunit 1266 you can now Encrypt Data without needing any additional software.


To use encryption you must first Enable Encryption under the Data Encryption Management Page.

When you click on the Enable Encryption Ribbon Action Item you will get the following messages:

Once you have the Encryption Enabled you can now add code below to Encrypt and Decrypt any field in NAV.

    PROCEDURE EncryptData@1(DataToEncrypt@1000 : Text);

    VAR           

      EncryptionManagement@1003 : Codeunit 1266;

      OutStream@1001 : OutStream;

    BEGIN

      IF EncryptionManagement.IsEncryptionEnabled THEN

        DataToEncrypt := EncryptionManagement.Encrypt(DataToEncrypt);

      Value.CREATEOUTSTREAM(OutStream);

      OutStream.WRITE(DataToEncrypt);

    END;

    PROCEDURE DecryptData@2() : Text;

    VAR

      EncryptionManagement@1003 : Codeunit 1266;

      InStream@1000 : InStream;

      DataToDecrypt@1001 : Text;

    BEGIN

      CALCFIELDS(Value);

      Value.CREATEINSTREAM(InStream);

      InStream.READ(DataToDecrypt);

      IF EncryptionManagement.IsEncryptionEnabled THEN

        EXIT(EncryptionManagement.Decrypt(DataToDecrypt));

      EXIT(DataToDecrypt);

    END;

The Encryption Management updates in Microsoft Dynamics NAV 2015 is just what the Dr. ordered to make encrypting data a painless process.

Microsoft Gold Partner Logo_edited.png
  • LinkedIn Social Icon
  • Twitter Social Icon
  • Facebook Social Icon
  • YouTube Social  Icon

Austin  |  Dallas  |  Houston  |  New Orleans  |  Nashville