Search code examples
c#apache-flexairactivexhasp

Is there a way to envelope Adobe AIR (SWF/Flex) application into C# application to use HASP protection


We have an Adobe AIR application which uses Flex Framework. It was initially built for browser version, but now we also need to use it as stand-alone application. This is possible to do using Adobe AIR.

However we need to use IP protection with this application, for our server side app we use SafeNet (formerly Alladin) HASP keys. The same keys can be used for encrypting client stand-alone application, but set of languages supported by these keys is very limited and the easiest one would be C# (.NET).

HASP protection works as follows: Execute encrypted binary, the decryption engine will check for USB key, if it is present the decryption mechanism written on key will decrypt the app into memory and execute it.

So the question is - what would be the best (easy and safe) way to embed SWF/AS files into C# app so these files will also be encrypted and therefore protected?

PS: I've read other questions regarding this matter and there is no way to use HASP protection with AIR directly, but some questions imply that it is possible to use SWF apps from C# app through ActiveX container.

PPS: Maybe that's a silly question, but I have no experience with C#, therefore any links, explanations, detailed instructions or examples will be appreciated.


Solution

  • If all you want is to get your C# application encrypted with your swf/flex file, you can add the swf file to your C# application as an embedded resource. That way you'll only have one executable file, and it will contain the swf application.

    When your C# application starts, you'll need to get the swf file and execute it (but it seems you know what to do here).

    Here is a tutorial about how to embed binary resources in your application and extract them at execution time: http://www.dotnetscraps.com/dotnetscraps/post/Insert-any-binary-file-in-C-assembly-and-extract-it-at-runtime.aspx