Last active
August 31, 2018 10:02
-
-
Save vivami/bdeb32458db2c33655cb46470bd7fdd9 to your computer and use it in GitHub Desktop.
Encrypt .NET assembly to string
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String path = args[0]; | |
key = getRandomKey(); | |
String filename = Path.GetFileNameWithoutExtension(path).ToString(); | |
String obfuscatedBin = obfuscateBinary(path); | |
private String obfuscateBinary(String file) { | |
byte[] assemblyBytes = fileToByteArray(@file); | |
byte[] encryptedAssembly = encrypt(assemblyBytes, key); | |
return System.Convert.ToBase64String(encryptedAssembly); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment