📄 00000001.htm
字号:
<HTML><HEAD> <TITLE>BBS水木清华站∶精华区</TITLE></HEAD><BODY><CENTER><H1>BBS水木清华站∶精华区</H1></CENTER>发信人: afei (飞色精灵), 信区: Java <BR>标 题: CAB&SIGN技术(2)---ATL, MFC control <BR>发信站: BBS 水木清华站 (Tue Dec 16 16:00:43 1997) <BR> <BR>Creating Signed CAB Files for MFC and ATL Controls <BR> <BR>If you plan to distribute MFC and ATL controls via the Internet, you should package them as <BR>signed Cabinet (CAB) files. Signed files assure a user downloading your control that the code is <BR>safe. A CAB file contains a compressed version of your control plus information about how your <BR>control is to be installed, for example, what DLLs need to be installed along with the OCX. <BR> <BR>The tools you need to create and sign CAB files are provided on the Visual C++ 5.0 CD in the <BR>CAB&SIGN directory. The utilities in the CAB&SIGN directory are not installed automatically <BR>when you install Visual C++, so you must copy the contents of the CAB&SIGN directory to your <BR>hard drive. <BR> <BR>Before you can sign files, you need to get a Software Publisher Certificate. You must apply for <BR>your own certificate to a Certification Authority. With the tools in the CAB&SIGN directory you <BR>can create a test certificate for testing purposes, but this certificate cannot be used to sign code for <BR>distribution. See step 1 for information about applying for a Software Publisher Certificate. <BR> <BR>These are the steps to create a signed CAB file: <BR> <BR>1. Get a Software Publisher Certificate (you only need to do this once) <BR> <BR>2. Create the CAB file <BR> <BR>3. Sign your files <BR> <BR>4. Embed the signed CAB file in a Web page (optional) <BR> <BR> <BR> <BR>Getting a Software Publisher Certificate <BR> <BR>Before you can sign files, you need to obtain a Software Publisher Certificate (SPC). To do this, <BR>you must make a request to a Certification Authority. During the application process, you must <BR>generate a key pair and provide the Certification Authority with identification information, such <BR>as your name, address, and public key. You must also make a legally binding pledge that you <BR>cannot and will not distribute software you know or should have known contains viruses or will <BR>otherwise maliciously harm the user's machine or code. <BR> <BR>For more information about obtaining a Software Publisher Certificate (SPC), see Signing Code <BR>with Microsoft's Authenticode. To apply for a certificate, see Digital Certificates for <BR>Authenticode. To create a test certificate to test signing your files, see Making A Test Software <BR>Publisher Certificate. <BR> <BR>The Certification Authority generates a Software Publisher Certificate that conforms to the <BR>industry standard X.509 certificate format with Version 3 extensions. The certificate identifies <BR>you and contains your public key. It is stored by the Certification Authority for reference and a <BR>copy is returned to you via electronic mail. After accepting the certificate, you should include a <BR>copy in all published software signed with the private key. <BR> <BR>Making a Test Software Publisher Certificate <BR> <BR>You can use the MAKECERT and CERT2SPC utilities provided in the CAB&SIGN directory on <BR>the Visual C++ 5.0 CD to make a test Software Publisher Certificate. Note that this test SPC is not <BR>valid for software publishing, but can be used to test code signing. <BR> <BR>To make a private key file called MYKEY.PVK and a company certificate called CERT.CER, run <BR>the MAKECERT utility with the following command: <BR> <BR> C:\CAB&SIGN\MAKECERT -u:MyKey -n:CN=MySoftwareCompany -k:MYKEY.PVK CERT.CER <BR> <BR>MyKey is the name you give to your key and MySoftwareCompany is the name of your company. <BR>Note that the MAKECERT utility is case sensitive to command-line options, so you must use <BR>lowercase -u, -n, and -k. The value for the -n option must be an uppercase CN=. <BR> <BR>To create a test Software Publisher Certificate (SPC) called CERT.SPC, run the CERT2SPC <BR>utility with the following command: <BR> <BR> C:\CAB&SIGN\CERT2SPC C:\CAB&SIGN\ROOT.CER CERT.CER CERT.SPC <BR> <BR>Note that the CERT.SPC file is created from the CERT.CER file you created with MAKECERT <BR>and from the ROOT.CER file provided in the CAB&SIGN directory. <BR> <BR> <BR> <BR>Creating a CAB File <BR> <BR>This section describes creating CAB files for distributing ATL and MFC controls over the <BR>Internet. If you need more information about CAB files, see the Cabinet File Reference in the <BR>Platform SDK section Setup and System Management Services\Setup API\Overview\Cabinet <BR>Files. The Platform SDK is included with the Visual C++ 5.0 online documentation. <BR> <BR>To create a CAB file: <BR> <BR>1. Create an INF file. <BR>2. Run the CABARC utility (available in the CAB&SIGN directory on the CD). For example: <BR> <BR> C:\CAB&SIGN\CABARC -s 6144 n MYCTL.CAB NEEDED1.DLL NEEDED2.DLL MYCTL.OCX MYCTL.INF <BR> <BR>CABARC creates a CAB file called MYCTL.CAB. <BR> <BR>You should run CABARC in the directory that contains your source files (the INF, OCX, and DLL <BR>files). The files archived in the CAB file should be listed on the command line in the same order <BR>they are listed in the INF file. In the example above, the INF file should list NEEDED1.DLL first, <BR>then NEEDED2.DLL, then MYCTL.OCX. <BR> <BR>The -s option reserves space in the cabinet for code signing. The n command specifies that you <BR>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -