Prizes & Awards
My Profile
Active Members
TodayLast 7 Days
more...
|
Resources » Articles » .NET Framework »
Cryptography in .NET
|
Introduction
Cryptography is the science of analyzing and deciphering codes and ciphers and cryptograms. The usage of cryptography is critical nowadays, since lot of confidential data is being transferred through highly insecure mediums. Though the mediums claim to be much secured, there are possibilities of vulnerabilities.
Cryptography mainly deals with encrypting data and decrypting it, the main purpose is to have an secure transmission of data in networks, and also in data storage.
How its done
Cryptography uses different algorithms to convert a data to another form, though it may be in human readable form, no one can get the data about what is being represented in it until the reader has the particular key to view it.
The goal of every encryption algorithm is to make it as difficult as possible to decrypt the data without the proper key.
Encryption Types:
There are two types of encryption
1) Public-Key encryption Or Asymmetric encryption 2) Private-Key encryption Or Symmetric encryption
Public-Key encryption
Public-Key encryption is also known as asymmetric encryption. This type of encryption uses public and private key for encryption and decryption. The public-key as its name represents, will be made available to anyone and this key is mainly used for encrypting data, this encrypted data is the one that is sent to the intended receiver. This person will be having the private key to view the exact data, without the private key there is no possibility of viewing the data. The private key is the only key that will allow data encrypted with the public key to be decrypted.
The key can be used multiple times or it can be generated for only onetime use.
Asymmetric encryption algorithms are mainly used to for encrypting only small amounts of data. The .NET framework supports the following public-key algorithms * Digital Signature Algorithm (DSA) * RSA*
Private-Key encryption
Private-Key encryption is also known as symmetric encryption, because it uses a single key to encrypt and decrypt information. As far as this key is concerned, it has to be kept secretly, otherwise the data will be compromised. Private-Key algorithms are relatively fast and used to encrypt and decrypt large streams of data.
Further private-key algorithms are also known as block ciphers, because they encrypt data one block at a time. The problem with the block ciphers is that if anything were known about the structure of the data, patterns could be detected and they could possibly be reverse engineered. But .NET framework provides facility to combat this, the classes in .NET framework use a process known as chaining where information from the previous block is used in encrypting the current block, this prevents the key being discovered. For encrypting this data it requires a initialization vector (IV)
The .NET Framework provides the following private-key algorithms.
* Data Encryption Standard (DES) This algorithm encrypts and decrypts data in 64-bit blocks, using a 64-bit key, though the key is 64-bit the effective key strength is only 56-bits. Advanced Hardware devices are available that can search all the possible DES keys in a reasonable amount of time. So this algorithm is considered somewhat obsolete.
* RC2 is a variable key-size block cipher. The key size can vary from 8-bit up to 64-bits for the key. It was specifically designed as a more secure replacement to DES. The processing speed is two to three times faster than DES. However, the RC2CryptoServiceProvider available in the .NET Framework is limited to 8 characters, or a 64-bit key. The 8-character limitation makes it susceptible to the same brute force attack as DES.
* TripleDES algorithm uses three successive iterations of the DES algorithm. The algorithm uses either two or three keys. Just as the DES algorithm, the key size is 64-bit per key with an effective key strength of 56-bit per key. The TripleDES algorithm was designed to fix the shortcomings of the DES algorithm, but the three iterations result in a processing speed three times slower than DES alone.
* Rijndael algorithm, one of the Advanced Encryption Standard (AES) algorithms, was designed as a replacement for the DES algorithms. The key strength is stronger than DES, and was designed to out perform DES. The key can vary in length from 128, 192, to 256 bits in length. This is the algorithm I personally trust the most and that I'll use for the examples contained in the column.
Summary
The encryption and decryption technique can be used to store sensitive data in the databases. For example if user passwords are encrypted and stored in the databases, then its highly secured against unauthorized intrusions. Even though if the system is compromised, the intruder has to know the original algorithm and the key to retrieve the data.
|
Responses
|
| Author: Vasudevan Deepak Kumar 03 Dec 2005 | Member Level: Diamond Points : 0 | I have come across this tool called XCrypt with sourcecode from http://www.codeproject.com/csharp/xcrypt.asp, which you can easily use in your applications.
Certain Encryption algorithms like BlowFish which do not have .NET class libraries also seems to be supported in this opensource component.
|
|