INFO: Frequently Asked Questions for CAB Files

Last reviewed: January 29, 1998
Article ID: Q168941
The information in this article applies to:
  • Microsoft Win32 Virtual Machine for Java
  • Microsoft Visual J++, versions 1.0, 1.1
  • SDK for Java, version 2.0

SUMMARY

This article covers some of the Frequently Asked Questions (FAQ) about CAB files. For other Java related FAQs search the Web at http://support.microsoft.com/support for "JAVA" and "FAQ."

MORE INFORMATION

Q. 1. Why do I receive the error Microsoft JScript runtime error [Line: 15] Object doesn't support this property or method when navigating to a page that contains a CAB file with Internet Explorer 3.02?

A. The file Extrac32.exe is not part of the Internet Explorer 3.02 distribution. The new release of the Microsoft VM for Java, build 1518, now includes the extrac32.exe utility. This file is required for proper CAB operation in Internet Explorer. If you have previously installed a version of IE 3.x earlier than 3.02 or have installed build 1518 of the Microsoft VM for Java, by clicking the "Java VM update" link from http://www.microsoft.com/java, Extrac32.exe will be on your system.

Q. 2. Where do I get the Code Sign Kit?

A. You can find the Code Sign Kit on the Visual J++ CD, the ActiveX SDK, or the Java signing tools in the SDK for Java 2.0 Beta 2 or newer. The ActiveX SDK is available at http://www.microsoft.com/INTDEV/sdk/. The SDK for Java 2.0 Beta 2 is available at http://www.microsoft.com/java/.

Q. 3. Where can I get the CAB Developers Kit or the CAB Resource Kit and what are they used for?

A. The CABDEVKIT has been incorporated into the SDK for Java, which is available at http://www.microsoft.com/java/sdk, and it's also available standalone from http://www.microsoft.com/workshop/prog/cab/default.htm. It will give you all of the tools you need to build cabinets. The latest version includes cabarc.exe, a new tool that makes it easier to create cabinets -directly from the command line.

The CAB Resource Kit will provide the information necessary to help the tool development community understand and work with cabinets. It includes the compression and decompression APIs, documentation on their interfaces, and sample applications using these APIs. Soon, we will add more information on the cabinet file format. The updates provided on January 13, 1997 featured multi-thread and multi-context support, and allow use in MFC- based applications.

Q. 4. When programmatically creating a CAB file from a Java application, can I reserve space in a CAB for signing?

A. The Java CAB API currently does not support the creation of reserved areas. The command line tools, Cabarc.exe and Diamond.exe support this functionality. The latest version of the Signcode.exe utility that is available in the SDK for Java 2.0 Beta 2 and newer, does not require space to be reserved in the CAB file for a digital signature. It will automatically create space in the CAB when it is signed.

Q. 5. Can I sign a Java class file for use with Internet Explorer?

A. Although it is possible to digitally sign a Java class file and verify the signature using the ChkTrust utility, Internet Explorer does not recognize the class as signed and present a certificate to the user at runtime, furthermore, the class is not considered trusted by the Microsoft VM for Java. Presently, you need to place the classes within a CAB file, which can then be signed.

Q. 6. Will the Microsoft Virtual Machine for Java support the JAR file format?

A. JAR support is the same as ZIP. JAR = ZIP + manifest. So we will support uncompressed and compressed JAR, but not signed JAR. If you need Java security (beyond sandbox), on Internet Explorer 4.0 you need to use a signed CAB file. This applies to all fine grained Java security (including running in a sandbox on the local machine using the package manager).

Q. 7. Can my applet, which is inside a CAB file, use class files from outside the CAB, which are not installed in the local machine's CLASSPATH?

A. Class files from a Web server cannot be used by classes in a CAB file with the Microsoft VM for Java, build 1517 and earlier. With build 2057 of the VM, from the SDK for Java 2.0 Preview, you can use classes from outside of CAB file.

Q. 8. Why doesn't Internet Explorer display the test certificate from my signed CAB file?

A. If you are using a test certificate to sign your cab file, you must enable test certificates for the machine otherwise the signature is not considered valid. You can do this by running Setreg.exe from the SDK for Java 2.x (SDK\BIN\PACKSIGN) as follows:

   setreg 1 true

or the Wvtston.reg file included with the code signing kit.

Q. 9. When I run signcode.exe on my CAB file, I get the following error:

   q1. Unable to sign the program <cabfile>. (80004005)

   a. You did not reserve space in your CAB file. Recreate the CAB file
      using the -s 6144 option to cabarc.exe. This space must be reserved
      in the CAB file to allow room for the digital signature.  Note, it is
      not necessary to use the -s switch with the signing tools included
      with the SDK for Java 2.0 Beta2 or newer.  The signcode.exe utility
      will now create the necessary space for the certificate at the time
      the CAB is signed.

   q2. Unable to sign the program <cabfile>. (80030070)

   a. You did not reserve enough space in your CAB file. Recreate the CAB
      file using the -s 6144 option to cabarc.exe. NOTE: It is not
      necessary to use the -s switch with the signing tools included with
      the SDK for Java 2.0 Beta2 or newer.  The signcode.exe utility will
      now create the necessary space for the certificate at the time the
      CAB is signed.

   q3. Unable to sign the program <cabfile>. (80070005)

   a. Your cabfile is marked read-only.

   q4. Unable to sign the program <cabfile>. (80070057)

   a. Your cabfile is corrupt.

Q. 10. When do I use the -s option for cabarc.exe?

A. The -s 6144 option reserves unnecessary space in most situations. With the 'test' certificate, you can typically get by with 1K of reserved space in the cab. A good estimate of the space required is slightly larger than the size of the .SPC file you are signing with. Also note, it is possible that the certificate will require more than 6144 bytes.

NOTE: It is not necessary to use the -s switch with the signing tools included with the SDK for Java 2.0 Beta2 or newer. The signcode.exe utility will now create the necessary space for the certificate at the time the CAB is signed.

Q. 11. When do I use the -i option for cabarc.exe?

A. The -i switch is used to insert a version number, SET ID, into a CAB file. The version number will be displayed when viewing a cab file with the following command line statement: cabarc L <cabfile>. Diamond.exe uses the ID number when spanning multiple CAB files.

Q. 12. How do I install a Java package on the user's machine?

A. You can use a setup information (.INF) file in a CAB to install Java libraries and packages on the local machine. The INF file defines which files to extract from the CAB and where to place them on the user's system. There is an example INF file called master.inf included in the SDK for Java. Place all the Java libraries and packages in a CAB file. In a second signed CAB file, place the unsigned CAB file and the .INF file. Reference the signed CAB file with an <OBJECT> tag in your HTML page.

Q. 13. For distributing trusted applets on my Intranet, is there a more elegant solution than using a test certificate?

A. Currently, the only solution is to relax the security in Internet Explorer by placing the classes on the user's machine in the CLASSPATH or distributing the files in a signed CAB file. You can obtain a certificate for use within the company or use the test certificate and have the users run the wvtston.reg file to enable test certificates on their machines.

Q. 14. Can I include GIF, JPG, or AU files used by my applet in a CAB file?

A. Yes, the CAB file serves as a single, compressed repository for all .CLASS, audio and image files required by the applet. When creating the CAB file, be sure to use the -r and -p options to cabarc.exe to recurse and preserve directory structure if any of the files in the CAB are in subdirectories. The cabarc.exe command L can be used to confirm the directory structure was preserved.

Image and audio clips stored in the cab can be retrieved by the applet code via the java.lang.Applet.getImage and java.lang.applet.getAudioClip methods. Note that in order for Internet Explorer to find an image file or audio clip from within the cab file, the URLs passed to these methods must be based upon the applet's codebase. For example, if the following code is found within an applet loaded from a cab file, the image file picture1.gif, and the audio clip sound1.au will be loaded from the cab file (assuming that they are in the cab).

   .
   .
   .

   Image img = getImage(getCodeBase(),"picture1.gif");
   AudioClip clip = getAudioClip(getCodeBase(),"sound1.au");
   .
   .
   .

NOTE: If an image or audio clip file is not within the cab, then Internet Explorer will look for them on the server.

Q. 15. Why doesn't Internet Explorer display the certificate from a signed CAB on some machines?

A. The three most common reasons for this behavior are the following:

   1. If the cab file was signed using a test certificate, you must enable
      test certificates for the local machine otherwise the signature is
      not considered valid. You can do this by running the wvtston.reg
      file included with the code signing kit.

   2. You have accepted a software publisher as 'always trusted'. To
      verify this, in Internet Explorer, go to
      view.Options.Security.Publishers to ensure the publisher does not
      appear in the listbox. If so, you can use this dialog to remove it.

   3. If the client machine is running Microsoft Windows NT, the current
      user must have administrator privileges or have 'Full Control'
      access to the following registry keys: (and existing subkeys)

   -HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography
   -HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SystemCertificates
   -HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SharedDlls
   -HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WinTrust

      These privileges can be granted by a user on the machine who has
      administrator privileges  using regedt32.exe. This requirement will
      be addressed in future versions of Internet Explorer.

      Note: If the certificate does not appear or you answer 'no' to the
      certificate, the applet will still load but will not be trusted.

REFERENCES

For the latest Knowledge Base articles and other support information on Visual J++ and the SDK for Java, see the following page on the Microsoft Technical Support site:

   http://support.microsoft.com/support/visualj/
   http://support.microsoft.com/support/java/

(c) Microsoft Corporation 1997, All Rights Reserved. Contributions by Rafael M. Munoz, Microsoft Corporation
Keywords          : kberrmsg CmdLnUtils UtilPkg VJMisc kbfaq
Technology        : kbInetDev
Version           : 1.0 1.1
Platform          : WINDOWS
Issue type        : kbinfo


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: January 29, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.