// TODO - check, why we have to use the local header instead of the CDS sometimes...
protected void initFromRaFile() throws IOException {
		// Central directory structure / central file header signature
		int censig = raFile.readInt( fileOffset );
		if( censig!=CENSIG ) {
			throw new ZipException("expected CENSIC not found in central directory (at end of zip file)");
		} else if( LOG.isLoggable(Level.FINE) ) {
			LOG.fine( "found censigOffset=" + fileOffset );
		}
		short flag = raFile.readShort( fileOffset + 8 );
		this.isEncrypted = (flag&1)>0;
		this.fileNameLength = raFile.readShort( fileOffset + 28 );
		byte[] fileNameBytes = raFile.readByteArray( fileOffset + 46, fileNameLength );
		this.fileName = new String( fileNameBytes, AesZipFileDecrypter.charset );
		if( LOG.isLoggable(Level.FINE) ) {
			LOG.fine( "fileName = " + this.fileName );
		}
		this.extraFieldOffset = this.fileOffset + 46 + this.fileNameLength;
		this.extraFieldLength = raFile.readShort( fileOffset + 30 );
		this.localHeaderOffset = raFile.readInt( fileOffset + 28 + 14 );
		if( LOG.isLoggable(Level.FINE) ) {
			LOG.fine( "CDS - extraFieldOffset =" + Long.toHexString(this.extraFieldOffset) );
			LOG.fine( "CDS - extraFieldLength =" + this.extraFieldLength );
			LOG.fine( "CDS - localHeaderOffset=" + Long.toHexString(this.localHeaderOffset) );
		}
		// TODO - check, why we have to use the local header instead of the CDS sometimes...
		if( this.isEncrypted ) {
			byte[] efhid = raFile.readByteArray( this.extraFieldOffset, 2 );
			if( efhid[0]!=0x01 || efhid[1]!=(byte)0x99 ) {
				this.extraFieldOffset = localHeaderOffset+30+fileNameLength;
				this.extraFieldLength = raFile.readShort( localHeaderOffset+28 );
				if( LOG.isLoggable(Level.FINE) ) {
					LOG.fine( "local header - extraFieldOffset=" + Long.toHexString(this.extraFieldOffset) );
					LOG.fine( "local header - extraFieldLength=" + Long.toHexString(this.extraFieldLength) );
				}
				if( 0==extraFieldLength ) {
					throw new ZipException("extra field is of length 0 - this is probably not a WinZip AES encrypted entry");
				}
				efhid = raFile.readByteArray( extraFieldOffset, 2);
				if( efhid[0]==0x01 && efhid[1]==(byte)0x99 ) {
					this.isAesEncrypted = true;
				}
			} else {
				this.isAesEncrypted = true;
			}
			if( this.isAesEncrypted ) {
				this.actualCompressionMethod = raFile.readShort( getExtraFieldOffset() + 9 );
				this.localHeaderSize = 30 + getExtraFieldLength() + getFileNameLength();
			}
		}
		this.compressedSize = raFile.readInt( fileOffset + 20 );
		this.uncompressedSize = raFile.readInt( fileOffset + 24 );
	}
LOG.fine( "CDS - localHeaderOffset=" + Long.toHexString(this.localHeaderOffset) );
}
// TODO - check, why we have to use the local header instead of the CDS sometimes...
if( this.isEncrypted ) {
byte[] efhid = raFile.readByteArray( this.extraFieldOffset, 2 );
LOG.fine( "fileName = " + this.fileName );
}
this.extraFieldOffset = this.fileOffset + 46 + this.fileNameLength;
this.extraFieldLength = raFile.readShort( fileOffset + 30 );
this.localHeaderOffset = raFile.readInt( fileOffset + 28 + 14 );
if( LOG.isLoggable(Level.FINE) ) {
LOG.fine( "CDS - extraFieldOffset =" + Long.toHexString(this.extraFieldOffset) );
LOG.fine( "CDS - extraFieldLength =" + this.extraFieldLength );
LOG.fine( "CDS - localHeaderOffset=" + Long.toHexString(this.localHeaderOffset) );
}
// TODO - check, why we have to use the local header instead of the CDS sometimes...
if( this.isEncrypted ) {
byte[] efhid = raFile.readByteArray( this.extraFieldOffset, 2 );
if( efhid[0]!=0x01 || efhid[1]!=(byte)0x99 ) {
this.extraFieldOffset = localHeaderOffset+30+fileNameLength;
this.extraFieldLength = raFile.readShort( localHeaderOffset+28 );
if( LOG.isLoggable(Level.FINE) ) {
LOG.fine( "local header - extraFieldOffset=" + Long.toHexString(this.extraFieldOffset) );
LOG.fine( "local header - extraFieldLength=" + Long.toHexString(this.extraFieldLength) );
}
if( 0==extraFieldLength ) {
throw new ZipException("expected CENSIC not found in central directory (at end of zip file)");
} else if( LOG.isLoggable(Level.FINE) ) {
LOG.fine( "found censigOffset=" + fileOffset );
}
short flag = raFile.readShort( fileOffset + 8 );
this.isEncrypted = (flag&1)>0;
this.fileNameLength = raFile.readShort( fileOffset + 28 );
byte[] fileNameBytes = raFile.readByteArray( fileOffset + 46, fileNameLength );
this.fileName = new String( fileNameBytes, AesZipFileDecrypter.charset );
if( LOG.isLoggable(Level.FINE) ) {
LOG.fine( "fileName = " + this.fileName );
}
this.extraFieldOffset = this.fileOffset + 46 + this.fileNameLength;
this.extraFieldLength = raFile.readShort( fileOffset + 30 );
this.localHeaderOffset = raFile.readInt( fileOffset + 28 + 14 );
if( LOG.isLoggable(Level.FINE) ) {
LOG.fine( "CDS - extraFieldOffset =" + Long.toHexString(this.extraFieldOffset) );
LOG.fine( "CDS - extraFieldLength =" + this.extraFieldLength );
LOG.fine( "CDS - localHeaderOffset=" + Long.toHexString(this.localHeaderOffset) );
}
// TODO - check, why we have to use the local header instead of the CDS sometimes...
if( this.isEncrypted ) {
byte[] efhid = raFile.readByteArray( this.extraFieldOffset, 2 );
if( efhid[0]!=0x01 || efhid[1]!=(byte)0x99 ) {
this.extraFieldOffset = localHeaderOffset+30+fileNameLength;
this.extraFieldLength = raFile.readShort( localHeaderOffset+28 );
if( LOG.isLoggable(Level.FINE) ) {
LOG.fine( "local header - extraFieldOffset=" + Long.toHexString(this.extraFieldOffset) );
LOG.fine( "local header - extraFieldLength=" + Long.toHexString(this.extraFieldLength) );
}
if( 0==extraFieldLength ) {
throw new ZipException("extra field is of length 0 - this is probably not a WinZip AES encrypted entry");
}
efhid = raFile.readByteArray( extraFieldOffset, 2);
if( efhid[0]==0x01 && efhid[1]==(byte)0x99 ) {
this.isAesEncrypted = true;
}
} else {
this.isAesEncrypted = true;
}
if( this.isAesEncrypted ) {