The Manifest

The manifest file contains information about the contents of a JAR. It is a human-readable file, consisting of name and value pairs. These are grouped into sections, with each section separated by a blank line. With the exception of the first section, every section corresponds to a file in the JAR. The first section consists of one value, indicating the manifest version used in the rest of the file. Currently, this is 1.0, so the first line of the manifest file looks like this:

Manifest-Version: 1.0

The section corresponding to the computer.au file looks like this:

Name: audio/computer.au
Digest-Algorithms: SHA MD5
SHA-Digest: zJMcY3mfFhSUPj8kdfZxKKJAXUM=
MD5-Digest: 5OWrlZ4NgfWzsXuuiwxrHg==

As you can see, the manifest file includes message digests of every file in the JAR. Two different algorithms are used to calculate a message digest, and the value of the digest for each algorithm is listed. Every file has a section like this, with the sections separated by blank lines.

You can specify additional information about an entry. You can specify, for example, that a .class file is a Java Bean by adding this entry to its section:

Java-Bean: True

So how do we add information to the manifest file? When the JAR is created, you can specify additional information that should be included in the manifest. For example, if we wanted to mark Edge.class as a Java Bean, we would create a file with the following information:

Name: Edge.class
Java-Bean: True

Save this file as add.mf. Then, we ...

Get Java Cryptography now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.