[Chrome] Application of RSA Algorithm in extended programs

Source: Internet
Author: User

The RSA algorithm is used in Chrome extensions to sign and generate an ID for its. crx Installation File. Let's take a look at the technical details one by one. Before proceeding, please note that the technical details of Web Store in this article are inferred from some tests from the perspective of Chrome browser, to thoroughly understand the details of Web Store, you cannot simply use this article.


There are two ways to generate the installer file: one is generated by the developer of the extension program during development, and the other is called Gallery through Google's Web StoreGoogle) the submission is generated by the background server. Although there are some differences between the two methods, we can roughly understand the Web Store behavior from the developer generation method.


The developer of the extension can open the installation file generation dialog box through the entries listed.

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/11414U202-0.png "title =" 1.png"/>


In the package extension dialog box, select the root directory of the package Extension Program and the optional private key file. This file is related to the RSA algorithm, this is the focus we will discuss later.

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/11414R3G-1.png "title =" 2.png"/>


When we do not select the private key file for packaging, Chrome will generate a private key file with the suffix. pem for us to be in parallel with the specified extension directory ). The file contains the private key of the RSA algorithm, and the private key can be used to export the public key. This example shows how to use the openssl tool to display the private key file and export the Public Key through the file.

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/11414U919-2.png "title =" 3.png"/>


The following activity diagram shows how Chrome packages an extension in the background.

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/11414TX6-3.png "title =" 4.png"/>


The. crx binary file format is shown in. Note that the entire directory of the extension program is stored in a compressed package. at the end of the crx file, the Signature is the Signature obtained through the Public Key, used to ensure the integrity of the compressed file content.

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/11414TY0-4.png "title =" 5.png"/>


So far, I believe that the reader has understood the role of the RSA Algorithm in the. crx Installation File. Next, let us know the ID of the Extension Program, also known as the App ID ). Every extension in Chrome has an ID value, which is an example of the ID value of the AdBlock extension). This value is obtained by performing Hash operations on the Public Key.

650) this. width = 650; "src =" http://img1.51cto.com/attachment/201305/150917481.png "title =" 6.png"/>


The example shows how to generate the extension ID in the background when packaging the extension program in Chrome, and also describes how to process the RSA key source.

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/11414TH9-6.png "title =" 7.png"/>


Note that because the ID is generated through the Public Key, and the Public Key is exported by the Private Key, if you want to ensure that the ID of an extension will never change, the same one must be used in the packaging process. pem file. In reality, we can choose not to specify the. pem file when packaging the extension for the first time so that Chrome can automatically generate the file for us, and then specify the. pem file in all subsequent packaging actions. Of course, if you do not care about the immutability of the ID, you can let the package automatically generate the. pem file each time. The readers can choose based on their own scenarios.


Once the extension is installed, You need to upload it through the Developer Dashboard of Google Web Store so that you can install it through Web Store. Different from creating a. crxfile, the uploaded file is a. ZIP file generated by compressing the extended directory. Note that the manifest. json of the extension cannot contain the key and update_url fields. By studying the extensions installed by Chrome, we can find that the key field stores the Public Key mentioned earlier, and both fields are inserted by the server in the background. Because the. pem file does not need to be specified in this packaging method, we can assume that the packaging server will automatically generate a Private Key for it.


This article from "to Jane Li cloud" blog, please be sure to keep this source http://yunli.blog.51cto.com/831344/1211260

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.