Daily Archives: December 11, 2012

Run asp.net on ubuntu 12.10 linux

Thanks to mono we can run asp.net on our linux machines (i have to test some asp.net code), to do that we will use XSP, here the description took it from mono website.

XSP is a standalone web server written in C# that can be used to run your ASP.NET applications with minimal effort. XSP works under both the Mono and Microsoft runtimes. The code is available from our download page (look for XSP web server) or from the Anonymous SVN repository (module name: xsp).

To nstall it:

  1.  

Once installed, just start XSP from the directory where your code is located, after that you can browse to http://localhost:8080 to see your web pages

  1.  

Crypting data using 3des on c#

Today i have to use c# to crypt some data using 3des, so here is a pretty basic example to do it, i test it using mono.

  1.  
  2. using System;
  3. using System.Security.Cryptography; // used for TripleDESCryptoServiceProvider
  4. using System.Text; // used for Encoding.ASCII.GetBytes
  5. // i create the 3des object
  6.                 byte[] key = Encoding.ASCII.GetBytes("123456781234567812345678"); // the key should be 24 chars long
  7. "Here goes the data to encrypt";
  8.                 des.Mode = CipherMode.CBC; // We’ll use CBC
  9.                 des.Key = key; // I set the key
  10.                 byte[] iv = des.IV; // I store the randomly generated IV since i will need for decrypt
  11. // i will print as readble data