C#.NET Integration

Parent Previous Next

C#.NET Integration.

This chapter contains an example on how to integrate and encapsulate the DLL API. The source code is written in C# for .NET and demonstrates one way of encapsulating the DLL API. It should be quite easy to understand and convert into another programming language, if this is required.


You'll find the C# source code in full length here.


DISCLAIMER: The source code is provided "AS IS" with no guarantees what so ever. You may copy, modify and use the presented source code at your own risk. Much of the presented code is being (or has been) used for our own internal testing of SCRAMBLECODE, but it may need some adjustment to match your requirements.


The Primary Goal.

This implementation intends to create a C#.NET class which provides public functions similar to these library functions:


@VMCreate, @VMFree, @VMGC, @VMExecute

@VMClearCells,

@VMCellIsInteger, @VMCellIsBytes, @VMCellIsString,

@VMCellGetInteger, @VMCellGetBytes, @CellGetString,

@VMCellSetInteger, @VMCellSetBytes, @VMCellSetString.


The C# implementation will:


Demonstrating the C# Class.

Implementing the @VMxxxx library functions as C# functions makes it very easy for the host application to create a VM and manage the bytecode execution.


The page Working With the Class exemplifies how to use the implemented C# class functions, and it demonstrates the many similarities between C# and SCRAMBLECODE when it comes to VM related programming.


The RSA Signature Example contains C# and SCRAMBLECODE source code to demonstrate, how to first sign some sensitive data in .NET, and then later how to authenticate the data and signature in bytecode. This can be used to verify, that the sensitive data (e.g. a license file) has not been changed by others.