In my software, I have loaded in a VB.NET EXE into a byte-array, encrypted it with System.Security.Cryptography.Rijndael.
Then I encoded the encrypted EXE as a Base64-string and then put it as a string constant in my decryptor application.
The decryptor application asks for a password/licensekey and then Rijndael-decrypt the code, and then tries to run it.
The code which run the decoded software is this, and this run in a new thread:
feature1code is a byte() array containing the decoded software.Code:Dim a As Assembly = Assembly.Load(feature1code) Dim method As MethodInfo = a.EntryPoint Dim o As Object = a.CreateInstance(method.Name) >> method.Invoke(o, New Object(0) {"1"})
The error message:
Im are 100 % sure that the software decrypts successfully, since when I look at "a" in the debugger, I can see the assembly name of the decrypted application, and all corresponding data.System.ArgumentException: Object of type 'String' cannot be converted to type 'String[]' raised at ">>"
If you want to try this for yourself, put this in sub main of a consoleapplication:
************************************************** *******Code:Dim feature1code() as Byte Dim fs As New System.IO.FileStream("C:\application.exe", System.IO.FileMode.Open) Dim bs As New System.IO.BinaryReader(fs) feature1code = bs.ReadBytes(Convert.ToInt32(fs.Length)) bs.Close() fs.Close() Dim a As System.Reflection.Assembly = System.Reflection.Assembly.Load(feature1code) Dim method As System.Reflection.MethodInfo = a.EntryPoint Dim o As Object = a.CreateInstance(method.Name) method.Invoke(o, New Object(0) {"1"})
SOLVED
************************************************** *******
Solution:I posted this in multiple forums, for example Flashback forum and Devshed forums and got answer in Flashback forum.Code:method.Invoke(o, New Object() {New String() {"1"}})


LinkBack URL
About LinkBacks




Reply With Quote



Bookmarks