CLR Reading Notes-Chapter 3 shared assembly and forced named assembly

Source: Internet
Author: User

3.1 Two Types of Assembly deployment

1. CLR supports two types of Assembly: weak named assembly and strong named assembly;

The difference between the two: a strongly-named Assembly uses a pair of publisher's public/private key pairs for signature, which uniquely identifies the Assembly publisher;

Poorly-named Assembly can only be deployed in private mode, and strongly-named assembly can be deployed globally;

3.2 assign Strong names to the Assembly

1. a strongly-named assembly consists of four important attributes used to uniquely identify the Assembly:

@ 1 a file name (excluding the extension); @ 2 a version number; @ 3 A Language and Culture identifier; @ 4 a public key;

2. Ms uses standard public/private key encryption technology to ensure the uniqueness of the Assembly;

3. To create a strongly-named assembly, follow these steps:

Step 1: Use strong name(sn.exe) to obtain a key;

Step 2: Upgrade the original assembly to a strongly-named assembly;

3.3 Global Assembly Cache

1. Global Assembly Cache GAC: An assembly must be stored in a known directory to be accessed by multiple applications. The known location is GAC (Global Assembly Cache );

2. The gac directory is structured. You must use tool (gacutil.exe) to place the Assembly in GAC. You cannot place a weak-name assembly in GAC;

3. The purpose of registering an assembly in GAC: to prevent overwriting of an assembly with the same name;

3.4 Reference a strongly-named assembly in the generated assembly

1. csc.exe will try to find the assembly in the following directory for non-users:

@ 1 working directory;

@ 2 include the csc.exe directory;

@ 3 use the/lib compiler to switch the specified directory;

@ 4 directory using lib environment variables;

2. Two sets of assembly files will be installed when the. NET Framework is installed:

One set is installed in the compiler/CLR directory; the other is installed in a GAC subdirectory;

The top 3.5 named assembly can defend against tampering

1. when installing a strongly-named assembly to GAC, the system will hash the content of the file containing the list and compare the hash value with the RSA Digital Signature embedded in the PE file, if they are consistent, it indicates that they have not been tampered with and the system has

It will hash other files. If there is an inconsistency, it indicates that the files have been tampered.

2. If the strongly-named assembly is installed outside of GAC, CLR will compare the hash value during loading.

 

(⊙ O ⊙ )! I am confused. I don't know what it is...

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.