How to: create a public/private key pair?

Source: Internet
Author: User

To markProgramYou must have a pair of public and private keys. Creating a key pair. The key file usually has a. SNK file extension.

● Create a key pair

At the command prompt, type the following command:

Sn-k <File Name>

In this command, <File Name> is the name of an output file containing the key pair.

The following example creates a key pair file named sgkey. SNK.

Sn-K sgkey. SNK

If you want to delay the identification assembly and control the entire key pair (unlike external test scenarios and scenarios), you can use the following command to generate a pair of key pairs, then, the Public Key is extracted from the key pair to a separate file.

First, create a key pair:

Sn-K keypair. SNK

Then, extract the public key from the generated key pair file (keypair. SNK) and copy it to an independent file:

Sn-P keypair. SNK public. SNK

Once you create a key pair, you must place the file in a position that can be found by the strong naming tool.

When a strong name is used to identify an assembly, assembly connector (Assembly Linker (al.exe) searches for key files related to the current directory and outputs them to the current directory. When compiling with the command line tool, you can easily copy this key toCodeThe current directory of the module.

If you are using vistual studio that does not have signature options in earlier versions of project properties, the recommended key file location is in the project directory where file attributes are defined as follows.

[Assembly: assemblykeyfileattribute ("Keyfile. SNK")]

 

ArticleLink: [msdn] http://msdn.microsoft.com/en-us/library/6f05ezxy.aspx

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.