In this chapter, we looked at assemblies and security issues. Here's an overview of the topics:
Assemblies are the fundamental unit of deployment, security, and versioning in C#. A great deal of metadata about the assembly can be found in the assembly's manifest. You can set assembly attributes, such as AssemblyVersionAttribute , in code. Assemblies are .EXE or .DLL files.
You can store multiple modules in the same assembly using the assembly linker, al.exe. You can't create multi-module assemblies using C# in the IDE yet.
Shared assemblies must have a strong name , and they can be stored in the Global Assembly Cache (GAC). You can generate strong names with the sn tool, and you can add assemblies to the GAC with the gacutil tool, or by dragging them into the WINNT\Assembly folder in the Windows Explorer.
To use pointers in a C# application, you need to use the unsafe and fixed keywords. You also need to compile them with the /unsafe switch.
You can set permission levels for assemblies with the .NET Framework Configuration tool, creating code groups and assigning them permission sets.
You can encrypt data using the TripleDESCryptoServiceProvider class. When you encrypt data, you use an encryption key and an initialization vector, both of which are used later to decrypt that data. You can create a CryptoStream stream and pass it to StreamReader or StreamWriter constructors, allowing you to work with standard stream readers or stream writers to handle data in a transparent fashion.