The application of encryption technology in enterprise data security:
The application of large enterprise management software is more and more extensive, enterprises data platform involves local area network, WAN, Internet, etc., in all kinds of system storage enterprise key data volume is also more and more large, many data need to save for more than decades, even permanent preservation, key business data is the lifeblood of enterprise survival and valuable resources, Data security issues are becoming increasingly prominent. How to enhance the security, confidentiality, authenticity and integrality of enterprise software system becomes the focus of every software developer. From the point of view of protecting data, the generalized concept of data security can be divided into three parts: Data encryption, transmission security and identity authentication management.
- Data encryption is to transform sensitive plaintext data into hard-to-identify ciphertext data according to a certain cipher algorithm, and encrypt the same plaintext into different ciphertext by using different keys. When needed, you can use a key to restore ciphertext data to plaintext data, known as decryption. This allows for the confidentiality of the data. Data encryption is recognized as the only practical method to protect data transmission security, and an effective way to protect the security of stored data, which is the most important defense of data protection.
- Data transmission security refers to the need to ensure data security, integrity and non-tamper in the transmission process.
- The purpose of identity authentication is to determine whether the system and network visitors are legitimate users. Mainly uses the login password, represents the user identity of the goods (such as smart cards, IC cards, etc.) or to reflect the user's physiological characteristics of identity identification of the identity of the visitor.
There are many encryption algorithms, and in iOS development,MD5 is our common digest algorithm.
MD5:MD5 is message-digest algorithm 5 (Information-Digest algorithm 5) to ensure complete and consistent information transmission. is one of the widely used hashing algorithms (also translation digest algorithm, hashing algorithm), mainstream programming language has been widely MD5 implemented. The calculation of data (such as Chinese characters) as another fixed length value is the basic principle of the hashing algorithm, and the predecessor of MD5 is MD2, MD3 and MD4.
the MD5 algorithm has the following characteristics:
1, compressibility: Any length of data, calculated the length of the MD5 value is fixed.
2, easy to calculate: It is easy to calculate the MD5 value from the original data.
3, anti-modification: Any changes to the original data, even if only 1 bytes modified, the resulting MD5 value is very different.
4, strong anti-collision: known raw data and its MD5 value, it is very difficult to find a data with the same MD5 value (that is, falsification of data).
the role of MD5is to allow bulk information to be "compressed" into a confidential format before signing a private key with a digital signature software (that is, converting an arbitrary-length byte string into a long hexadecimal string). In addition to MD5, among them the more famous are sha-1, Ripemd and Haval and so on.Next, I'll go straight to practice, using MD5 for cryptographic operations:first, you need to introduce a class library #import <CommonCrypto/CommonCrypto.h> to invoke MD5.
1 #pragmaMark-Encrypt string2 3 //1. Prepare a string for the encryption4NSString *str =@"I Love U";//the same string is MD5 encrypted with the same content5 //2. Because MD5 is based on the C language, we need to encode the string6 Const Char*data =[str utf8string];7 //3. After the encrypted content, you need to use a string array to access (16 binary, 32 bit)8 //Cc_md5_digest_length represents the length of the9UnsignedCharresult [cc_md5_digest_length];Ten //4. MD5 Encryption One //parameter one: the content you want to encrypt data A //parameter two: a length of data to encrypt - //parameter three: MD5 - cc_md5 (data, (Cc_long) strlen (data), result); the - //5. Create a mutable string to save the result -nsmutablestring *mutablestring = [nsmutablestringstring]; - //6. Iterate through the result array and add to the variable string + for(inti =0; i < cc_md5_digest_length; i++) { - //16 binary format modifier%x,02 represents less than 2 bits, the front 0 +[Mutablestring AppendFormat:@"%02x", Result[i]]; A } atNSLog (@"%@", mutablestring);
Of course you can also encapsulate the MD5. Create a category that is easy to use next time. Internal implementation is the above step.
Beginner: Use MD5 to encrypt string operations