nc" string encryptedFile = fileName + ".enc"; descriptor = new DESCryptoServiceProvider () ; string stringInput; // Read file Contents to string FileStream fileRead = new FileStream (encryptedFile, FileMode. Create, FileAccess.Write) ; StreamReader strRead = new StreamReader (fileName) stringInput = (strRead) ReadToEnd ( ) ; strRead.close () ; // Close stream reader // Convert string to byte array byte [] input = Encoding. Default. GetBytes (stringInput) ; // Encrypt data ICryptoTransform desencrypt = descriptor. CreateEncryptor ( ) ; CryptoStream output = newCryptoStream(fileRead, desencrypt, CryptoStreamMode.Write) ; output. Write (input, 0, input.Length) output. Close () ; fileRead. Close () ; // Close file reader 4. Next we can implement decryption. Decrypt function void Decrypt_Function( ) // FileStream reads the cipher text from the file FileStream fileRead = new FileStream (fileName, FileMode. Open, FileAccess.Read) ; // CryptoStream decrypts the data from the stream ICryptoTransform decrypt = descriptor.CreateDecryptor() ; Secure Communication CryptoStream streamCrypt = new CryptoStream (fileRead, decrypt, CryptostreamMode.Read) ; // StreamReader uses the ReadToEnd method to pull the // decrypted data into a string string decryptedFile = new StreamReader (streamCrypt) . ReadToEnd ( ) ; // To remove .enc extension from the filename FileInfo info = new FileInfo (fileName) ; string originalFile = ileName.Substring (0, fileName. Length - info. Extension.Length) ; // StreamWriter dumps the string containing the // decrypted data to disk StreamWriter fileWrite = new StreamWriter (originalFile) ; fileWrite. Write (decryptedFile) ; fileWrite. Close ( ) ; 31.8 Conclusion The intent of this chapter is to introduce the reader to the basic concepts of security implementation. Some of the fundamental concepts of symmetric and asymmetric cryptography were discussed. The security services and protocols will give the reader an understanding of security implementation at different layers. The implementation example discus