Options

Any solutions for encrypting C/AL code in 2013 R2..?

boywonderboywonder Member Posts: 179
edited 2013-12-02 in NAV Three Tier
I have a colleague who is looking for a product that can encrypt the C/AL code within his own solution objects in NAV 2013 R2 ... we know that this is possible with a 3rd party app. (it is actually in the download section of this forum) .. however the problem is that only up to NAV2009 as it relies on files such as CFront.dll etc. all from the 'Classic' folder .. of course these no longer exist in 2013 R2 as the Classic client was retired.

So ... can anyone recommend a reliable method for 2013R2 ..?

Comments

  • Options
    rdebathrdebath Member Posts: 383
    It's sort of possible to do the same sort of source code deletion with the RTC that you can do with the "classic" client. You can physically edit the object and delete the C/AL source code leaving behind the C# source code in the Object metadata table. But generally you'll have to have exactly the same version of the NAV install as your client so that when they import your denuded objects Nav doesn't attempt to regenerate the C# code. In addition the C# code isn't actually that unreadable once you get past all the 'reflection' boilerplate.

    As C/AL is a Pascallish language I'd suggest you're better off converting the bits of your code that are so special that everyone will want to copy them into a DotNET hosted version of Pascal and use the DotNET interop to run them.

    Don't forget to use the Dotfuscator to make sure that your super secret code cannot be reversed from the DotNET MSIL.
  • Options
    Alex_ChowAlex_Chow Member Posts: 5,063
    Possible in the classic client, but I'm not sure if it's possible now in the RTC.
  • Options
    rdebathrdebath Member Posts: 383
    It is, kinda, possible with the RTC. I got to look at some code for another partner who always seem to want to do this to their code.

    Basically, you delete the C/AL code in the object and leave the P-Code that used to be run by the classic client (if it's still there).
    The C# code is in the "Object metadata" table and IF nothing happens to trigger a regeneration of the C# code the service tier will continue to use the code that was generated when the object was saved.

    The C# code is stored (compressed) in the fob file so when a fob is imported (IF the versions match exactly) it can just be copied into the metadata table without actually being regenerated. (This makes FOB imports almost as fast as in V5)

    Still it's all very fragile, and as I said the C# code isn't really all that unreadable after all that, and it would probably not be too difficult to write some program that regenerates the C/AL code from the C# code. It would be a bit tedious but the translation looks like a direct one without any sort of optimisation; that comes later.
  • Options
    Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    In the RTC/Three tier stack it is always possible to reverse the encryption from the generated C# code.
Sign In or Register to comment.