Pack the OCX control into a cab and implement the digital signature process

Source: Internet
Author: User

OCX packaging cab and signing process

1. Package the cab

When creating a cab file, you must include all the relevant files. You can use depends (included in VC) to check the required files. Use the INF file to write these items.

1. Create an INF file

Default. inf

Generally, it is in the [version] area at the beginning:

Eg: [version]

Signature = "$ Chicago $"

Advancedinf = 2.0

Next is the most important [Add. Code] area:

Eg: [Add. Code]

Getcertocx. ocx = getcertocx. ocx

The above is the file name to be downloaded, followed by the region name corresponding to the file, which can be any name, but it is generally the same as the file name, so it is easy to maintain.

Next is the area of each file.

[Getcertocx. ocx]

File-win32-x86 = thiscab

Registerserver = Yes

CLSID = {0a0488cf-f9ab-4ac4-ad8f-cd893553dd22}

Destdir = 11

Fileversion = 1, 0

[Getcertocx. the first file value in the OCX] area tells ie where to get this OCX. File consists of three parts. The first part is file. This is always the case; the second part tells the declared supported OS. Win32 indicates windows, and Mac indicates Apple Mac ox. The third part is the CPU type, such as x86 and MIPS.

File values can be set to three: a URL, ignore, and thiscab. If it is a URL, it indicates the location of the URL. If it is ignore, it indicates the OS and CPU, you do not need to download this file. If it is thiscab, it will be in the current cab file.

The second part is the registerserver. You can take two values: Yes and no. If yes, it indicates that IE wants to register the OCX. If no, it is unnecessary;

Next is the CLSID. You need to enter the class guid of the ocx.

The next step is destdir. Its value is the location where OCX will be stored on the local hard disk. If its value is 10, place OCX under \ windows or \ WINNT. If it is 11, to \ WINDOWS \ SYSTEM or

\ Winnt \ system32; if it is null (that is, there is no value), it will be placed in the \ windows or \ WINNT Downloaded Program Files directory;

The last is fileversion, which indicates the OCX version.

2. Create a cab file

Use iexpress.exe (a wizard-type cab production tool provided by Windows)

Select "Create a new self-extract specified file" and click "Next ".

Select "create compressed file only (ActiveX installation)" and click "Next ".

Click "add" to add the created default. inf and getcertocx. ocx files, and click "Next ".

Click Browse, enter the name of the cab file to be generated, select Save file with long file name in the software package, and click Next ".

Select "do not save" and click "Next ".

Click "Next ".

Click "finish" to exit the wizard and generate the cab file.

2. Sign the cab file

Use signtool.exe to sign the cab file. Use the suffix parameter signwizard to display the digital signature wizard interface.

Click "Next ".

Click "Browse" to select the cab file to be signed, select "Cabinet file (*. Cab)" for the file type, and click "Next" after the selection ".

Select "typical" and click "Next ".

Click "select from storage area", select the certificate with the expected purpose of "code signature", and then click "Next ".

Enter the description of the signature data for "Description" and "web location (optional)", and click "Next ".

Select "add timestamp to data" and write it in the URL bar of the timestamp service:

Http://timestamp.verisign.com/scripts/timstamp.dll

Click "Next ".

Click "finish ".

Click "OK ".

Click "OK" to exit the digital signature wizard. The corresponding getcert. cab file has been signed.

You can right-click "getcert. Cab" and select "attribute" to view "Digital Signature" information.

Iii. Signature Certificate Application

You can go to http://www.ca365.com/website to apply for a certificate for free.

Click "apply for a certificate in a form", and the "Apply for a free certificate page" is displayed. You can enter the "identification information" at will. Select "code signature certificate" for "Certificate purpose ", "provided by the encryption service" is the "Microsoft string cryptographic prover" provided by Microsoft. By default, click "Submit.

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.