What programs can be used to open the. SNK file?

Source: Internet
Author: User
SNK, Program When the suffix is used, it is a strong key in. Net to encrypt the file! When you put an assembly into GAC (Global Assembly Cache), you must enhance the name (signature ), the Assembly in GAC can be referenced and accessed by all programs (equivalent to the previous COM component registration in the registry, this Assembly (private assembly) needs to be copied when using this Assembly. Therefore, you do not need to use a strong name, depending on the situation. if you do not want. DLL sharing can be performed without a strong name to ensure the security of your DLL file. Generally, we can use a DLL file wherever we reference it, but if we use a strong name, the dll will have a secret key, and others will not be able to reference how to create an assembly with a strong name. You can assign a strong-name encrypted signature to the Assembly, it provides a unique name for the Assembly and prevents others from borrowing your Assembly name (name spoofing ). If you are deploying an assembly that will be shared by multiple applications on the same computer, the Assembly must have a strong name. Even if you only use the Assembly in your application, use a strong name to ensure that the correct version of the Assembly is loaded. The first step to generate an assembly with a strong name is to obtain an encryption key pair .. Net Framework SDK includes a "Strong name" tool (sn.exe) that can be used to generate key pairs ). Key pairs generated by the "Strong name" tool can be stored in files, or you can store them in the "encryption service provider" (CSP) on your local computer. The following command uses the "Strong name" tool to generate a new key pair and store it in the name testkey. in the SNK file: Sn-K testkey. after obtaining the key pair, SNK needs to add correct custom attributes to the source file so that the compiler can issue an assembly with a strong name. Select the attribute correctly based on whether the key pair used for signature is included in the file or the key container in the CSP. For keys stored in files, use system. reflection. assemblykeyfileattribute. For keys stored in CSP, use system. reflection. assemblykeynameattribute. (*) If no key is specified, the Assembly will not be signed. // (*) Keyname refers to the key in the encryption service provider (CSP) installed on // computer. Keyfile is a file containing a // key. // (*) If both the Keyfile and keyname values are specified, // The following processing occurs: // (1) if the keyname can be found in CSP, the key is used. // (2) if the keyname does not exist and the Keyfile exists, the key in the // Keyfile is installed in CSP and used. // (*) To create a Keyfile, you can use the sn.exe (strong name) utility. // When Keyfile is specified, the location of the Keyfile should be // relative to the "Project output directory ". The location of the project output // directory depends on whether you are using a local project or a Web project. // For local projects, the project output directory is defined as // <project directory> \ OBJ \ <configuration>. For example, if the Keyfile is located in the // project directory, you should specify the assemblykeyfile // attribute as [Assembly: assemblykeyfile (".. \\.. \ mykey. SNK ")] // for a web project, the project output directory is defined as // % homepath % \ vswebcache \ <machine Name> \ <project directory> \ OBJ \ <configuration>.

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.