Posts

Showing posts from February, 2019

AES Encryption Decryption .NET Core 2

So if you saw my earlier post about this the code there didn't work for me. but who know me knows i don't give up that easily, there might be a NuGet here or there that do this but i needed to know how this is done! so after 3 hours of digging code on the internet and trying the code for a dozen of times, below is the code which did work for me. i know that the IV should be dynamic in order to further protect this more and this is something i will work on. public static class Crypto { public static string EncryptString(string text, string keyString) { var key = Encoding.UTF8.GetBytes(keyString); var textToChiper = Encoding.UTF8.GetBytes(text); using (var aesAlg = Aes.Create()) { aesAlg.Padding = PaddingMode.PKCS7; aesAlg.Mode = CipherMode.CBC; aesAlg.KeySize = (key.Length * 8); aesAlg.IV = new byte[16]; aesAlg.Key = key;

Let's use a publish profile on that Azure Pipeline on TFS !

So we have TFS at work and i have been planning to create a build for a vendor web app which we used the DI the vendor implemented to inject our own custom modules/apps. i managed previously to create a customized publish profile to produce a web package that contain both the vendor DLLs and our own. <!--Cutome entry to include custom DLLs--> <target name="CollectHelpers"> <itemgroup> <_customfiles include="$(MSBuildProjectDirectory)\bin\Custom*.dll"> <filesforpackagingfromproject include="%(_CustomFiles.Identity)"> <destinationrelativepath>bin\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath> </filesforpackagingfromproject> </_customfiles> </target> <target name="CollectCustomizations"> <itemgroup> <_customfiles include="$(MSBuildProjectDirectory)\bin\*Custom*.dll"> <filesforpackagingfrom