APIdia Launch Partner
Top Description Inners Fields Constructors Methods
sun.security.util

public Class ManifestDigester

extends Object
Class Inheritance
Imports
java.security.MessageDigest, java.util.ArrayList, .HashMap, .List, java.io.ByteArrayOutputStream, .OutputStream, .IOException

This class is used to compute digests on sections of the Manifest. Please note that multiple sections might have the same name, and they all belong to a single Entry.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
pack-priv static class
ManifestDigester.Position

state returned by findSection

private static class

Field Summary

Modifier and TypeField and Description
private final HashMap<String, ManifestDigester.Entry>
entries

individual sections by their names

private final ManifestDigester.Entry
public static final String
MF_MAIN_ATTRS

The part "Manifest-Main-Attributes" of the main attributes digest header name in a signature file as described in the jar

Specification

x-Digest-Manifest-Main-Attributes (where x is the standard name of a MessageDigest algorithm): The value of this attribute is the digest value of the main attributes of the manifest.
private final byte[]
rawBytes

the raw bytes of the manifest

Constructor Summary

AccessConstructor and Description
public
ManifestDigester(byte[] bytes)

Method Summary

Modifier and TypeMethod and Description
private boolean

Returns:

false if end of bytes has been reached, otherwise returns true
findSection
(int
should point to the starting offset with in the raw bytes of the next section.
offset
,
ManifestDigester.Position pos)

find a section in the manifest.

public ManifestDigester.Entry
get(String name)

public ManifestDigester.Entry
get(String name, boolean oldStyle)

public ManifestDigester.Entry
public ManifestDigester.Entry
getMainAttsEntry(boolean oldStyle)

private boolean
isNameAttr(byte[] bytes, int start)

public byte[]
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

entriesback to summary
private final HashMap<String, ManifestDigester.Entry> entries

individual sections by their names

mainAttsEntryback to summary
private final ManifestDigester.Entry mainAttsEntry
MF_MAIN_ATTRSback to summary
public static final String MF_MAIN_ATTRS

The part "Manifest-Main-Attributes" of the main attributes digest header name in a signature file as described in the jar

Specification

x-Digest-Manifest-Main-Attributes (where x is the standard name of a MessageDigest algorithm): The value of this attribute is the digest value of the main attributes of the manifest.
See Also
JAR File Specification, section Signature File, getMainAttsEntry
rawBytesback to summary
private final byte[] rawBytes

the raw bytes of the manifest

Constructor Detail

ManifestDigesterback to summary
public ManifestDigester(byte[] bytes)

Method Detail

findSectionback to summary
private boolean findSection(int offset, ManifestDigester.Position pos)

find a section in the manifest.

Parameters
offset:int

should point to the starting offset with in the raw bytes of the next section.

Returns:boolean

false if end of bytes has been reached, otherwise returns true

Annotations
@SuppressWarnings:fallthrough
getback to summary
public ManifestDigester.Entry get(String name)
getback to summary
public ManifestDigester.Entry get(String name, boolean oldStyle)
getMainAttsEntryback to summary
public ManifestDigester.Entry getMainAttsEntry()
See Also
MF_MAIN_ATTRS
getMainAttsEntryback to summary
public ManifestDigester.Entry getMainAttsEntry(boolean oldStyle)
See Also
MF_MAIN_ATTRS
isNameAttrback to summary
private boolean isNameAttr(byte[] bytes, int start)
manifestDigestback to summary
public byte[] manifestDigest(MessageDigest md)
sun.security.util back to summary

public Class ManifestDigester.Entry

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv boolean
private final List<ManifestDigester.Section>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private ManifestDigester.Entry
public byte[]
public byte[]
digestWorkaround(MessageDigest md)

Netscape doesn't include the new line.

public boolean
isProperlyDelimited()

Check if the sections (particularly the last one of usually only one) are properly delimited with a trailing blank line so that another section can be correctly appended and return true or return false to indicate that reproduction is not advised and should be carried out with a clean "normalized" newly-written manifest.

public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

oldStyleback to summary
pack-priv boolean oldStyle
sectionsback to summary
private final List<ManifestDigester.Section> sections

Constructor Detail

Entryback to summary
public Entry()

Method Detail

addSectionback to summary
private ManifestDigester.Entry addSection(ManifestDigester.Section sec)
digestback to summary
public byte[] digest(MessageDigest md)
digestWorkaroundback to summary
public byte[] digestWorkaround(MessageDigest md)

Netscape doesn't include the new line. Intel and JavaSoft do

isProperlyDelimitedback to summary
public boolean isProperlyDelimited()

Check if the sections (particularly the last one of usually only one) are properly delimited with a trailing blank line so that another section can be correctly appended and return true or return false to indicate that reproduction is not advised and should be carried out with a clean "normalized" newly-written manifest.

See Also
reproduceRaw
reproduceRawback to summary
public void reproduceRaw(OutputStream out) throws IOException
sun.security.util back to summary

pack-priv Class ManifestDigester.Position

extends Object
Class Inheritance

state returned by findSection

Field Summary

Modifier and TypeField and Description
pack-priv int
pack-priv int
pack-priv int

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

endOfFirstLineback to summary
pack-priv int endOfFirstLine
endOfSectionback to summary
pack-priv int endOfSection
startOfNextback to summary
pack-priv int startOfNext

Constructor Detail

Positionback to summary
pack-priv Position()
sun.security.util back to summary

private Class ManifestDigester.Section

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv int
pack-priv int
pack-priv int
pack-priv byte[]

Constructor Summary

AccessConstructor and Description
public
Section(int offset, int length, int lengthWithBlankLine, byte[] rawBytes)

Method Summary

Modifier and TypeMethod and Description
private static void
doOldStyle(MessageDigest md, byte[] bytes, int offset, int length)

private boolean
isProperlySectionDelimited()

Returns true if the raw section is terminated with a blank line so that another section can possibly be appended resulting in a valid manifest and false otherwise.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

lengthback to summary
pack-priv int length
lengthWithBlankLineback to summary
pack-priv int lengthWithBlankLine
offsetback to summary
pack-priv int offset
rawBytesback to summary
pack-priv byte[] rawBytes

Constructor Detail

Sectionback to summary
public Section(int offset, int length, int lengthWithBlankLine, byte[] rawBytes)

Method Detail

doOldStyleback to summary
private static void doOldStyle(MessageDigest md, byte[] bytes, int offset, int length)
isProperlySectionDelimitedback to summary
private boolean isProperlySectionDelimited()

Returns true if the raw section is terminated with a blank line so that another section can possibly be appended resulting in a valid manifest and false otherwise.