Sample program to encrypt and decrypt String using C# windows mobile programming !! Recently i wanted to Encrypt and Decrypt a password string in windows Mobile using C# .NetCF
but after trying many C# encryption which worked on desktop environment but did not worked on Mobile finally i got the simple encryption and decryption class on code project which did my job....
Click Here to download the class has two methods encrypt and decrypt encryption and decryption string along with a custom or default key this algorithm is for basic encryption and cannot be used where a strong encryption is needed
just add the downloaded class to your project and call the methods
To Encrypt
SSTCryptographer.Encrypt("Text to be encrypted","Google1998key");
To Decrypt
SSTCryptographer.Decrypt("+uISCwWHi3JswGpaiQMdHfIt5R94oEkW","Google1998key");
though i tried with most of the encryption algorithm that works on desktop .Net framework most of the does not work on .NetCF compact framework if you guys know any algorithm which is powerful and works on .NetCF perfectly do let us know...
Click Here to download the class has two methods encrypt and decrypt encryption and decryption string along with a custom or default key this algorithm is for basic encryption and cannot be used where a strong encryption is needed
just add the downloaded class to your project and call the methods
To Encrypt
SSTCryptographer.Encrypt("Text to be encrypted","Google1998key");
To Decrypt
SSTCryptographer.Decrypt("+uISCwWHi3JswGpaiQMdHfIt5R94oEkW","Google1998key");
though i tried with most of the encryption algorithm that works on desktop .Net framework most of the does not work on .NetCF compact framework if you guys know any algorithm which is powerful and works on .NetCF perfectly do let us know...


4 comments:
Thanks, a great code.
I think this line got error during build on the decrypt function as stated below:
string strDecrypted = ASCIIEncoding.ASCII.GetString(objDESCrypto.CreateDecryptor().TransformFinalBlock(byteBuff, 0, byteBuff.Length));
The error message is: No overload for method 'GetString' takes '1' arguments
Can you advice how we can fix this? Thanks
Replace line with the below line it will work
ASCIIEncoding.ASCII.GetString(objDESCrypto.CreateDecryptor().TransformFinalBlock(byteBuff, 0, byteBuff.Length), 0, objDESCrypto.CreateDecryptor().TransformFinalBlock(byteBuff, 0, byteBuff.Length).Length);
Hi, thanks a lot. It's working now:). You are brilliat.
On separate issue, I have a challenge. When I release the WM Application to user, in future I would like to issue update on the software. How can I do that? If I create a cab file, will it detect the original one and update it? If the target platform dont have the original one, it should not allow them to execute. Any idea how to achieve this? Thanks again.
have you seen http://dalelane.co.uk/blog/?p=234 ?
Post a Comment