0

I am currently working in a programm that has the abillity for implementors to save Vb code in a specific form of the programm , and then the programm includes the code in an auto generated class of the core programm. Is there anyway in VB.NET in a sub() to place some type of command like the following ?

Sub()

Read and Decrypt file from c:\xxxx\xxxx.txt (the file will contain my code)

End sub

so that the program then puts the code in execution from a somehow encrypted file ...

Now , it does something like this :

Namespace ESDynamicallyGeneratedCode

Public Class Autogenerated_7268126381276

Inherits Ent.Framework.Platform.CustomCommandsTemplate.ExprEvaluatorImpl 

{My Code}

End Class

End Namespace
Ted Kon
  • 87
  • 1
  • 6
  • Other than the (trivial) encryption step, what you're describing is generally called a plug-in architecture when the third-party code is compiled. When interpreted at runtime it's called scripting. In general what you're proposing is not feasible since there is no way for the code in the file to have any idea of what context it will find itself in in the program. This makes it tightly coupled, meaning authors would need your source to make it work. – J... May 07 '21 at 10:27
  • Or is this something else - like you're trying to protect proprietary code? There are also solutions for that... it would really help if you explained what you're trying to do. – J... May 07 '21 at 10:27
  • Imagine that the customer who has bought the program has the abillity to access the form of the programm , that the implemantors use to write additional code for him .It is a short of a plugin creation tool that even the customer can write and see code of custom plugins in his installation. The idea was so that the final customer doesnt has access to the code in special implemantations that he asked and were implemented not by him. For sure reference to a dll or something like that is a solution but i was just wondering if there was a plain text easy solution like encrypt a txt and your done! – Ted Kon May 07 '21 at 10:47
  • Why do you need the encryption then? And why do you think building a script compiler is easier than just consuming a framework compatible binary assembly? (hint : it's not) – J... May 07 '21 at 10:48
  • I think I explained why do I need encryption. I assume from your answer that there is no way that this can happen as simple as I described using a simple txt reference that will be encrypted. What about enclosing the whole code in a dll class library file with visual studio as it is and then place an imports reference for the specific dll in the code. If I do this then what command should I use in the code in order for the whole code inside the class to be executed – Ted Kon May 07 '21 at 15:41
  • Well, you have two distinct problems, so pick one to solve first. You're concerned about third-party users being able to generate plug-in code but to also protect that code from other third-parties. A suitable level of protection requires you to define the threat level you are defending against (casual copying? state level espionage?) Even a compiled assembly can be reverse engineered. As for allowing user scripting, yes - read the duplicate I posted above. – J... May 07 '21 at 15:48
  • There is nothing special about encrypting a text file with a script in it compared to a text file with any other text, so no special answer is needed here. Any number of other questions exist here with good answers explaining how to encrypt and decrypt a file. – J... May 07 '21 at 15:48

0 Answers0