Class PKWareExtraHeader

  • All Implemented Interfaces:
    Direct Known Subclasses:
    X0014_X509Certificates, X0015_CertificateIdForFile, X0016_CertificateIdForCentralDirectory, X0017_StrongEncryptionHeader, X0019_EncryptionRecipientCertificateList

    public abstract class PKWareExtraHeader
    extends Object
    implements ZipExtraField
    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
    • 0x6601 - DES
    • 0x6602 - RC2 (version needed to extract < 5.2)
    • 0x6603 - 3DES 168
    • 0x6609 - 3DES 112
    • 0x660E - AES 128
    • 0x660F - AES 192
    • 0x6610 - AES 256
    • 0x6702 - RC2 (version needed to extract >= 5.2)
    • 0x6720 - Blowfish
    • 0x6721 - Twofish
    • 0x6801 - RC4
    • 0xFFFF - Unknown algorithm
    Hash Algorithms - integer identifier of the hash algorithm from the following range
    • 0x0000 - none
    • 0x0001 - CRC32
    • 0x8003 - MD5
    • 0x8004 - SHA1
    • 0x8007 - RIPEMD160
    • 0x800C - SHA256
    • 0x800D - SHA384
    • 0x800E - SHA512
    • Method Detail

      • setLocalFileDataData

        public void setLocalFileDataData​(byte[] data)
        Set the extra field data in the local file data - without Header-ID or length specifier.
        data - the field data to use
      • getLocalFileDataData

        public byte[] getLocalFileDataData()
        Get the local data.
        Specified by:
        getLocalFileDataData in interface ZipExtraField
        the local data
      • setCentralDirectoryData

        public void setCentralDirectoryData​(byte[] data)
        Set the extra field data in central directory.
        data - the data to use
      • getCentralDirectoryLength

        public ZipShort getCentralDirectoryLength()
        Get the central data length. If there is no central data, get the local file data length.
        Specified by:
        getCentralDirectoryLength in interface ZipExtraField
        the central data length
      • getCentralDirectoryData

        public byte[] getCentralDirectoryData()
        Get the central data.
        Specified by:
        getCentralDirectoryData in interface ZipExtraField
        the central data if present, else return the local file data