Top Description Inners Fields Constructors Methods
org.apache.commons.compress.archivers.zip

public abstract Class PKWareExtraHeader

extends Object
implements ZipExtraField
Class Inheritance
All Implemented Interfaces
org.apache.commons.compress.archivers.zip.ZipExtraField
Known Direct Subclasses
org.apache.commons.compress.archivers.zip.X0014_X509Certificates, org.apache.commons.compress.archivers.zip.X0015_CertificateIdForFile, org.apache.commons.compress.archivers.zip.X0016_CertificateIdForCentralDirectory, org.apache.commons.compress.archivers.zip.X0017_StrongEncryptionHeader, org.apache.commons.compress.archivers.zip.X0019_EncryptionRecipientCertificateList
Imports
java.util.Arrays, .Collections, .HashMap, .Map, java.util.zip.ZipException

Base class for all PKWare strong crypto extra headers.

This base class acts as a marker so you know you can ignore all extra fields that extend this class if you are not interested in the meta data of PKWare strong encryption.

Algorithm IDs - integer identifier of the encryption algorithm from the following range Hash Algorithms - integer identifier of the hash algorithm from the following range
Since
1.11

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
public static enum

Field Summary

Modifier and TypeField and Description
private byte[]
centralData

Extra field data in central directory - without Header-ID or length specifier.

private final ZipShort
private byte[]
localData

Extra field data in local file data - without Header-ID or length specifier.

Constructor Summary

AccessConstructor and Description
protected
PKWareExtraHeader(final ZipShort headerId)

Method Summary

Modifier and TypeMethod and Description
protected final void
assertMinimalLength(final int minimum, final int length)

public byte[]

Returns:

the central data if present, else return the local file data
getCentralDirectoryData
()

Implements org.apache.commons.compress.archivers.zip.ZipExtraField.getCentralDirectoryData.

Gets the central data.
public ZipShort

Returns:

the central data length
getCentralDirectoryLength
()

Implements org.apache.commons.compress.archivers.zip.ZipExtraField.getCentralDirectoryLength.

Gets the central data length.
public ZipShort

Returns:

the header id
getHeaderId
()

Implements org.apache.commons.compress.archivers.zip.ZipExtraField.getHeaderId.

Gets the header id.
public byte[]
public ZipShort

Returns:

the length of the local data
getLocalFileDataLength
()

Implements org.apache.commons.compress.archivers.zip.ZipExtraField.getLocalFileDataLength.

Gets the length of the local data.
public void
parseFromCentralDirectoryData(final byte[]
the array of bytes.
data
,
final int
the source location in the data array.
offset
,
final int
the number of bytes to use in the data array.
length
)

Implements org.apache.commons.compress.archivers.zip.ZipExtraField.parseFromCentralDirectoryData.

Populate data from this array as if it was in central directory data.
public void
parseFromLocalFileData(final byte[]
the array of bytes.
data
,
final int
the source location in the data array.
offset
,
final int
the number of bytes to use in the data array.
length
)

Implements org.apache.commons.compress.archivers.zip.ZipExtraField.parseFromLocalFileData.

Populate data from this array as if it was in local file data.
public void
setCentralDirectoryData(final byte[]
the data to use
data
)

Sets the extra field data in central directory.

public void
setLocalFileDataData(final byte[]
the field data to use
data
)

Sets the extra field data in the local file data - without Header-ID or length specifier.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

centralDataback to summary
private byte[] centralData

Extra field data in central directory - without Header-ID or length specifier.

headerIdback to summary
private final ZipShort headerId
localDataback to summary
private byte[] localData

Extra field data in local file data - without Header-ID or length specifier.

Constructor Detail

PKWareExtraHeaderback to summary
protected PKWareExtraHeader(final ZipShort headerId)

Method Detail

assertMinimalLengthback to summary
protected final void assertMinimalLength(final int minimum, final int length) throws ZipException
getCentralDirectoryDataback to summary
public byte[] getCentralDirectoryData()

Implements org.apache.commons.compress.archivers.zip.ZipExtraField.getCentralDirectoryData.

Gets the central data.

Returns:byte[]

the central data if present, else return the local file data

Annotations
@Override
getCentralDirectoryLengthback to summary
public ZipShort getCentralDirectoryLength()

Implements org.apache.commons.compress.archivers.zip.ZipExtraField.getCentralDirectoryLength.

Gets the central data length. If there is no central data, get the local file data length.

Returns:ZipShort

the central data length

Annotations
@Override
getHeaderIdback to summary
public ZipShort getHeaderId()

Implements org.apache.commons.compress.archivers.zip.ZipExtraField.getHeaderId.

Gets the header id.

Returns:ZipShort

the header id

Annotations
@Override
getLocalFileDataDataback to summary
public byte[] getLocalFileDataData()

Implements org.apache.commons.compress.archivers.zip.ZipExtraField.getLocalFileDataData.

Gets the local data.

Returns:byte[]

the local data

Annotations
@Override
getLocalFileDataLengthback to summary
public ZipShort getLocalFileDataLength()

Implements org.apache.commons.compress.archivers.zip.ZipExtraField.getLocalFileDataLength.

Gets the length of the local data.

Returns:ZipShort

the length of the local data

Annotations
@Override
parseFromCentralDirectoryDataback to summary
public void parseFromCentralDirectoryData(final byte[] data, final int offset, final int length) throws ZipException

Implements org.apache.commons.compress.archivers.zip.ZipExtraField.parseFromCentralDirectoryData.

Doc from org.apache.commons.compress.archivers.zip.ZipExtraField.parseFromCentralDirectoryData.

Populate data from this array as if it was in central directory data.

Parameters
data:byte[]

the array of bytes.

offset:int

the source location in the data array.

length:int

the number of bytes to use in the data array.

Annotations
@Override
Exceptions
ZipException:
on error
See Also
ZipExtraField#parseFromCentralDirectoryData(byte[], int, int)
parseFromLocalFileDataback to summary
public void parseFromLocalFileData(final byte[] data, final int offset, final int length) throws ZipException

Implements org.apache.commons.compress.archivers.zip.ZipExtraField.parseFromLocalFileData.

Doc from org.apache.commons.compress.archivers.zip.ZipExtraField.parseFromLocalFileData.

Populate data from this array as if it was in local file data.

Parameters
data:byte[]

the array of bytes.

offset:int

the source location in the data array.

length:int

the number of bytes to use in the data array.

Annotations
@Override
Exceptions
ZipException:
on error
See Also
ZipExtraField#parseFromLocalFileData(byte[], int, int)
setCentralDirectoryDataback to summary
public void setCentralDirectoryData(final byte[] data)

Sets the extra field data in central directory.

Parameters
data:byte[]

the data to use

setLocalFileDataDataback to summary
public void setLocalFileDataData(final byte[] data)

Sets the extra field data in the local file data - without Header-ID or length specifier.

Parameters
data:byte[]

the field data to use

org.apache.commons.compress.archivers.zip back to summary

public final Enum PKWareExtraHeader.EncryptionAlgorithm

extends Enum<PKWareExtraHeader.EncryptionAlgorithm>
Class Inheritance

Encryption algorithm.
Since
1.11

Field Summary

Modifier and TypeField and Description
public static final PKWareExtraHeader.EncryptionAlgorithm
public static final PKWareExtraHeader.EncryptionAlgorithm
public static final PKWareExtraHeader.EncryptionAlgorithm
private final int
private static final Map<Integer, PKWareExtraHeader.EncryptionAlgorithm>
public static final PKWareExtraHeader.EncryptionAlgorithm
public static final PKWareExtraHeader.EncryptionAlgorithm
public static final PKWareExtraHeader.EncryptionAlgorithm
public static final PKWareExtraHeader.EncryptionAlgorithm
public static final PKWareExtraHeader.EncryptionAlgorithm
public static final PKWareExtraHeader.EncryptionAlgorithm
public static final PKWareExtraHeader.EncryptionAlgorithm

Constructor Summary

AccessConstructor and Description
private
EncryptionAlgorithm(final int code)

private constructor for enum style class.

Method Summary

Modifier and TypeMethod and Description
public static PKWareExtraHeader.EncryptionAlgorithm

Returns:

the EncryptionAlgorithm for the given code or null if the method is not known
getAlgorithmByCode
(final int
the code of the algorithm
code
)

Returns the EncryptionAlgorithm for the given code or null if the method is not known.

public int

Returns:

the PKWare AlgorithmId
getCode
()

the algorithm id.

public static PKWareExtraHeader.EncryptionAlgorithm
public static PKWareExtraHeader.EncryptionAlgorithm[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

AES128back to summary
public static final PKWareExtraHeader.EncryptionAlgorithm AES128
AES192back to summary
public static final PKWareExtraHeader.EncryptionAlgorithm AES192
AES256back to summary
public static final PKWareExtraHeader.EncryptionAlgorithm AES256
codeback to summary
private final int code
codeToEnumback to summary
private static final Map<Integer, PKWareExtraHeader.EncryptionAlgorithm> codeToEnum
DESback to summary
public static final PKWareExtraHeader.EncryptionAlgorithm DES
RC2back to summary
public static final PKWareExtraHeader.EncryptionAlgorithm RC2
RC2pre52back to summary
public static final PKWareExtraHeader.EncryptionAlgorithm RC2pre52
RC4back to summary
public static final PKWareExtraHeader.EncryptionAlgorithm RC4
TripleDES168back to summary
public static final PKWareExtraHeader.EncryptionAlgorithm TripleDES168
TripleDES192back to summary
public static final PKWareExtraHeader.EncryptionAlgorithm TripleDES192
UNKNOWNback to summary
public static final PKWareExtraHeader.EncryptionAlgorithm UNKNOWN

Constructor Detail

EncryptionAlgorithmback to summary
private EncryptionAlgorithm(final int code)

private constructor for enum style class.

Method Detail

getAlgorithmByCodeback to summary
public static PKWareExtraHeader.EncryptionAlgorithm getAlgorithmByCode(final int code)

Returns the EncryptionAlgorithm for the given code or null if the method is not known.

Parameters
code:int

the code of the algorithm

Returns:PKWareExtraHeader.EncryptionAlgorithm

the EncryptionAlgorithm for the given code or null if the method is not known

getCodeback to summary
public int getCode()

the algorithm id.

Returns:int

the PKWare AlgorithmId

valueOfback to summary
public static PKWareExtraHeader.EncryptionAlgorithm valueOf(String name)
valuesback to summary
public static PKWareExtraHeader.EncryptionAlgorithm[] values()
org.apache.commons.compress.archivers.zip back to summary

public final Enum PKWareExtraHeader.HashAlgorithm

extends Enum<PKWareExtraHeader.HashAlgorithm>
Class Inheritance

Hash Algorithm
Since
1.11

Field Summary

Modifier and TypeField and Description
private final int
private static final Map<Integer, PKWareExtraHeader.HashAlgorithm>
public static final PKWareExtraHeader.HashAlgorithm
public static final PKWareExtraHeader.HashAlgorithm
public static final PKWareExtraHeader.HashAlgorithm
public static final PKWareExtraHeader.HashAlgorithm
public static final PKWareExtraHeader.HashAlgorithm
public static final PKWareExtraHeader.HashAlgorithm
public static final PKWareExtraHeader.HashAlgorithm
public static final PKWareExtraHeader.HashAlgorithm

Constructor Summary

AccessConstructor and Description
private
HashAlgorithm(final int code)

private constructor for enum style class.

Method Summary

Modifier and TypeMethod and Description
public static PKWareExtraHeader.HashAlgorithm

Returns:

the HashAlgorithm for the given code or null if the method is not known
getAlgorithmByCode
(final int
the code of the algorithm
code
)

Returns the HashAlgorithm for the given code or null if the method is not known.

public int

Returns:

the PKWare hashAlg
getCode
()

the hash algorithm ID.

public static PKWareExtraHeader.HashAlgorithm
public static PKWareExtraHeader.HashAlgorithm[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

codeback to summary
private final int code
codeToEnumback to summary
private static final Map<Integer, PKWareExtraHeader.HashAlgorithm> codeToEnum
CRC32back to summary
public static final PKWareExtraHeader.HashAlgorithm CRC32
MD5back to summary
public static final PKWareExtraHeader.HashAlgorithm MD5
NONEback to summary
public static final PKWareExtraHeader.HashAlgorithm NONE
RIPEND160back to summary
public static final PKWareExtraHeader.HashAlgorithm RIPEND160
SHA1back to summary
public static final PKWareExtraHeader.HashAlgorithm SHA1
SHA256back to summary
public static final PKWareExtraHeader.HashAlgorithm SHA256
SHA384back to summary
public static final PKWareExtraHeader.HashAlgorithm SHA384
SHA512back to summary
public static final PKWareExtraHeader.HashAlgorithm SHA512

Constructor Detail

HashAlgorithmback to summary
private HashAlgorithm(final int code)

private constructor for enum style class.

Method Detail

getAlgorithmByCodeback to summary
public static PKWareExtraHeader.HashAlgorithm getAlgorithmByCode(final int code)

Returns the HashAlgorithm for the given code or null if the method is not known.

Parameters
code:int

the code of the algorithm

Returns:PKWareExtraHeader.HashAlgorithm

the HashAlgorithm for the given code or null if the method is not known

getCodeback to summary
public int getCode()

the hash algorithm ID.

Returns:int

the PKWare hashAlg

valueOfback to summary
public static PKWareExtraHeader.HashAlgorithm valueOf(String name)
valuesback to summary
public static PKWareExtraHeader.HashAlgorithm[] values()