This article has been
excerpted from book "The Complete Visual C# Programmer's Guide" from the Authors
of C# Corner.
The .NET Framework security system is built to provide protection as software
undergoes the metamorphosis to multiple mobile components. The .NET security
system provides a fine-grained, extensible policy and permission system so that
people can run more powerful software code without compromising the system to
security-related risks. The .NET security system enables administrators to
create robust security policies at all levels because administrators are not
forced to determine the trust of users at runtime.
As you will see later, .NET security policies are completely customizable.
Developers can focus mainly on the application logic rather than delving into
security details. Thus they do not need to deal with security at the core level.
Security is handled capably by the CLR in the .NET Framework. Developers can use
and extend .NET security at any time.
Security, an essential part of the .NET Framework, starts immediately after a
class is loaded in the .NET runtime memory area; the framework performs many
initial verification checks to ensure that the code is accessing memory in a
controlled way. Then the framework controls code access to the resources via
code access security.
In the .NET Framework, all code is essentially type safe because it references
only memory blocks that have been reserved for its use and it accesses objects
only through valid, exposed interfaces. From a security point of view,
referencing only designated memory allows multiple objects to safely share a
single address space and allows the accessing of objects only through their
exposed interfaces, thus ensuring that security checks connected with these
specific interfaces are not omitted.
The .NET Framework's security model checks code security not only during load
time but also during runtime. It also allows security checks based on the
identity of the code and of the user. Security policies established and
maintained by administrators or developers govern the access to resources
granted to a given assembly.
The .NET Framework's security model has six major areas:
- type safety and verification, which ensures that code accesses memory in a controlled way;
- code signing, which ensures that code has not been tampered with after release by establishing an identity for the code;
- cryptographic services and data signing, which protect application data;
- code access security, which, based on the caller's identity and origin, provides permission to access resources;
- role-based security, which controls code access based on the user's identity; and
- isolated storage, which persists data in a safe way on a client computer.
Figure 22.3 depicts some significant features
of the code access security mechanism.

Figure 22.3: Code Access Security in Action
Figure 22.4 outlines some significant features of the role-based security
mechanism.

Figure 22.4: Role-Based Security in Action


Comments
Join the conversation! Your thoughts help the community grow.