To write a program for communications between the client and the server, you need to focus on encryption and decryption. Of course it is not a research because there are already many mature solutions and algorithms. I only knew it before, but now I need to have a deeper understanding. The following sections describe the information collected on the Internet and my personal understanding, which may be inaccurate.
Currently, two mainstream encryption and decryption technologies are available: symmetric and non-symmetric. In simple terms, symmetry means that both Parties exchange messages using the same key, such as a fixed-digit string. On the contrary, the two sides of asymmetric messages exchange different keys, that is, the common asymmetric encryption and decryption algorithms include public and private keys.
Symmetric encryption and decryption algorithms include DES, 3DES, and AES.
Asymmetric encryption and decryption algorithms: RSA
The following is a brief introduction to these algorithms:
DES
The DES algorithm is a symmetric cryptography algorithm developed by IBM in 1972.
3DES
3DES (Triple DES) is an encryption algorithm for the transition from DES to AES. It uses three 64-bit keys to encrypt data three times. It is a safer form of DES.
AES
AES is a 21-century encryption standard designed by NIST to replace DES. The basic requirement of AES is that the symmetric block cipher system is used. The minimum length of the key is 128, 192, 256, and the group length is 128 bits. The algorithm should be easy to implement by various hardware and software.
RSA
RSA is the most widely studied public key algorithm. It has been nearly two decades since it was proposed. It has been tested by various attacks and is gradually accepted by people, it is generally regarded as one of the best public key solutions at present.
XML Encryption
XML encryption provides end-to-end security for applications that require secure exchange of structured data. XML encryption and decryption can be performed using symmetric or asymmetric algorithms. XML and security have been integrated into the W3C XML encryption work draft.
OK. Now we have finished the technology introduction. Let's take a look at our test data.
Test Environment
Hardware: Thinkpad x200, Intel P8600 2.4 GHz, 6 gb ram, 500 GB (7200 RPM)
Software: Windows 7 Enterprise Edition x64, Visual Studio 2010
Development language:. NET (C #2.0)
Test Description
The code is cyclically executed 1000 times to encrypt and decrypt a string: cbcye.com using different algorithms and key lengths.
Test Results
Comparison of encryption and decryption technology processing time |
Technology |
Processing time of 1000 operations (Unit: milliseconds) |
Xml rsa encryption and decryption |
22114.4589 |
AES (128-bit) |
24.0014 |
AES (256-bit) |
30.0017 |
DES (56-bit) |
480.0275 |
RSA |
22723.2911 |
Well, the above is the preliminary test result for your reference. Download the program source code