Assemblies and Identity

for RuBoard

Assemblies are the unit of code deployment in the .NET Framework, roughly analogous to the .dll and .exe files used within the Windows environment today. A single assembly can be composed of multiple files, but exactly one of these files will contain what's known as the assembly manifest ”a database describing the overall layout of the assembly as well as various global attributes. The basic layout of an assembly is shown in Figure 9.1.

Figure 9.1. The structure of an assembly.

graphics/09fig01.gif

Assemblies are referenced (for example, from other assemblies and in assembly-qualified type names) through the use of names. These names can be complex entities, including a version number and culture reference on top of the text name. The text name is usually the name of the file containing the assembly manifest without the file extension. For example, an assembly contained within MyAssembly.dll most likely has the text name MyAssembly .

Strong naming is a process whereby an assembly name can be further qualified by the identity of the publisher. Thus, the likelihood of naming conflicts is greatly reduced (if we assume that a publisher can handle its own internal naming policy without conflicts). As a result, two publishers can safely distribute an assembly named MyAssembly without fear of ambiguity.

The identity of the publisher is used in the same way as a namespace that qualifies a classname or a file system path that qualifies a filename. This concept is illustrated in Figure 9.2.

Figure 9.2. Disambiguating assemblies.

graphics/09fig02.gif

To encourage the use of this mechanism in scenarios where naming conflicts are most likely (the use of shared code as described earlier), installation of an assembly into the global assembly cache requires that the assembly be strong named.

The strong aspect of strong naming derives from the fact that the publisher namespace is protected ”publisher B cannot publish an assembly in publisher A's namespace. This simplifies the understanding of assembly dependencies, because you now know that a copy of publisher A's assembly, even if provided to you by publisher B, cannot have been modified from its original condition. This also makes strong names useful from a security standpoint:

  • The strong name can be used as input to security policy, in that permissions can be assigned to an assembly based on the identity of the assembly's publisher. This is covered in Chapter 8, "Membership Conditions, Code Groups, and Policy Levels: The Brick and Mortar of Security Policy."

  • Individual methods on a class can restrict access based on the strong name of the caller's assembly. This is covered in Chapter 25.

for RuBoard


. NET Framework Security
.NET Framework Security
ISBN: 067232184X
EAN: 2147483647
Year: 2000
Pages: 235

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net