Cryptography
We will have an overview of Cryptography and particularly how it is implemented in .NET Framework.Cryptography is a technique for hiding information or data by transforming it.It used so that only the intended people can access it.The main idea in using cryptography is:
- Hiding the information by transforming it in such that only the intended people can read it.
- Hidden information can not be altered by intruders
Following are the main techniques used in Cryptography:
- Encryption conversion of data or information called plain text into secret information.
- Decryption conversion of encrypted data or information back to plain text.
- Hashing generating a unique string from a given string.
Encryption
There are two types of useful Encryption techniques:
- private-key or symmetric encryption uses single key for encryption and decryption
- public-key encryption or asymmetric encryption uses different keys for encryption and decryption
The System.Security.Cryptography namespace is used for implementing Cryptography in .NET.
following are the asymmetric algorithms classes used in .NET:
- RSA RSACryptoServiceProvider
- DSA DSACryptoServiceProvider
Symmetric algorithm classes in .NET:
- DES DESCryptoServiceProvider
- Rijndael RijndaelManaged
- TripleDES TripleDESCryptoServiceProvider
Symmetric and Asymmetric encryption are useful in different scenarios:
- Symmetric encryption is useful for encrypting large amounts of data.Example is stream of data
- Asymmetric encryption is useful for encrypting small amounts of data.
Hashing
Hashing is a technique of generating a unique string from a given string.Unlike encryption there is no way to retrieve the original string from the given input string.The advantage of hashing is that even if an intruder gets hold of the hashed string for a given string,he can not retrieve the original string from it.
In encryption if the intruder gets the encrypted string and knows the encryption algorithm and key then he can get the original input string.
In Salting a random string is added to the input string and the resulting string is hashed.This makes the hashed string more secure since random string is very difficult to guess by the intruder.
Hashing algorithm classes in .NET:
MD5 MD5 class
SHA SHA256Managed,SHA1Managed
You can use the following online tool for simple encryption
Leave a Reply