11.07.2015 Views

Improving Web Application Security: Threats and - CGISecurity

Improving Web Application Security: Threats and - CGISecurity

Improving Web Application Security: Threats and - CGISecurity

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 7: Building Secure Assemblies 155Strong NamesAn assembly strong name consists of a text name, a version number, optionally aculture, a public key (which often represents your development organization), <strong>and</strong> adigital signature. You can see the various components of the strong name by lookinginto Machine.config <strong>and</strong> seeing how a strong named assembly is referenced.The following example shows how the System.<strong>Web</strong> assembly is referenced inMachine.config. In this example, the assembly attribute shows the text name, version,culture <strong>and</strong> public key token, which is a shortened form of the public key.Whether or not you should strong name an assembly depends on the way in whichyou intend it to be used. The main reasons for wanting to add a strong name to anassembly include:● You want to ensure that partially trusted code is not able to call your assembly.The common language runtime prevents partially trusted code from calling astrong named assembly, by adding link dem<strong>and</strong>s for the FullTrust permission set.You can override this behavior by using AllowPartiallyTrustedCallersAttribute(APTCA) although you should do so with caution.For more information about APTCA, see APTCA in Chapter 8, “Code Access<strong>Security</strong> in Practice.”● The assembly is designed to be shared among multiple applications.In this case, the assembly should be installed in the global assembly cache. Thisrequires a strong name. The global assembly cache supports side-by-sideversioning which allows different applications to bind to different versions of thesame assembly.● You want to use the strong name as security evidence.The public key portion of the strong name gives cryptographically strong evidencefor code access security. You can use the strong name to uniquely identify theassembly when you configure code access security policy to grant the assemblyspecific code access permissions. Other forms of cryptographically strongevidence include the Authenticode signature (if you have used X.509 certificates tosign the assembly) <strong>and</strong> an assembly’s hash.Note Authenticode evidence is not loaded by the ASP.NET host, which means you cannot use itto establish security policy for ASP.NET <strong>Web</strong> applications.For more information about evidence types <strong>and</strong> code access security, seeChapter 8, “Code Access <strong>Security</strong> in Practice.”

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!