Package net.lingala.zip4j.io.inputstream
Class AesCipherInputStream
- java.lang.Object
-
- java.io.InputStream
-
- net.lingala.zip4j.io.inputstream.CipherInputStream<AESDecrypter>
-
- net.lingala.zip4j.io.inputstream.AesCipherInputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
class AesCipherInputStream extends CipherInputStream<AESDecrypter>
-
-
Field Summary
Fields Modifier and Type Field Description private byte[]
aes16ByteBlock
private int
aes16ByteBlockPointer
private int
aes16ByteBlockReadLength
private int
bytesCopiedInThisIteration
private int
lengthToCopyInThisIteration
private int
lengthToRead
private int
offsetWithAesBlock
private int
remainingAes16ByteBlockLength
private byte[]
singleByteBuffer
-
Constructor Summary
Constructors Constructor Description AesCipherInputStream(ZipEntryInputStream zipEntryInputStream, LocalFileHeader localFileHeader, char[] password, int bufferSize, boolean useUtf8ForPassword)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
copyBytesFromBuffer(byte[] b, int off)
private void
decrementRemainingAesBytesLength(int decrementBy)
protected void
endOfEntryReached(java.io.InputStream inputStream, int numberOfBytesPushedBack)
private byte[]
getPasswordVerifier()
private byte[]
getSalt(LocalFileHeader localFileHeader)
private void
incrementAesByteBlockPointer(int incrementBy)
protected AESDecrypter
initializeDecrypter(LocalFileHeader localFileHeader, char[] password, boolean useUtf8ForPassword)
int
read()
int
read(byte[] b)
int
read(byte[] b, int off, int len)
protected byte[]
readStoredMac(java.io.InputStream inputStream)
private void
verifyContent(byte[] storedMac, int numberOfBytesPushedBack)
-
Methods inherited from class net.lingala.zip4j.io.inputstream.CipherInputStream
close, getDecrypter, getLastReadRawDataCache, getLocalFileHeader, getNumberOfBytesReadForThisEntry, readRaw
-
-
-
-
Field Detail
-
singleByteBuffer
private byte[] singleByteBuffer
-
aes16ByteBlock
private byte[] aes16ByteBlock
-
aes16ByteBlockPointer
private int aes16ByteBlockPointer
-
remainingAes16ByteBlockLength
private int remainingAes16ByteBlockLength
-
lengthToRead
private int lengthToRead
-
offsetWithAesBlock
private int offsetWithAesBlock
-
bytesCopiedInThisIteration
private int bytesCopiedInThisIteration
-
lengthToCopyInThisIteration
private int lengthToCopyInThisIteration
-
aes16ByteBlockReadLength
private int aes16ByteBlockReadLength
-
-
Constructor Detail
-
AesCipherInputStream
public AesCipherInputStream(ZipEntryInputStream zipEntryInputStream, LocalFileHeader localFileHeader, char[] password, int bufferSize, boolean useUtf8ForPassword) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
initializeDecrypter
protected AESDecrypter initializeDecrypter(LocalFileHeader localFileHeader, char[] password, boolean useUtf8ForPassword) throws java.io.IOException
- Specified by:
initializeDecrypter
in classCipherInputStream<AESDecrypter>
- Throws:
java.io.IOException
-
read
public int read() throws java.io.IOException
- Overrides:
read
in classCipherInputStream<AESDecrypter>
- Throws:
java.io.IOException
-
read
public int read(byte[] b) throws java.io.IOException
- Overrides:
read
in classCipherInputStream<AESDecrypter>
- Throws:
java.io.IOException
-
read
public int read(byte[] b, int off, int len) throws java.io.IOException
- Overrides:
read
in classCipherInputStream<AESDecrypter>
- Throws:
java.io.IOException
-
copyBytesFromBuffer
private void copyBytesFromBuffer(byte[] b, int off)
-
endOfEntryReached
protected void endOfEntryReached(java.io.InputStream inputStream, int numberOfBytesPushedBack) throws java.io.IOException
- Overrides:
endOfEntryReached
in classCipherInputStream<AESDecrypter>
- Throws:
java.io.IOException
-
verifyContent
private void verifyContent(byte[] storedMac, int numberOfBytesPushedBack) throws java.io.IOException
- Throws:
java.io.IOException
-
readStoredMac
protected byte[] readStoredMac(java.io.InputStream inputStream) throws java.io.IOException
- Throws:
java.io.IOException
-
getSalt
private byte[] getSalt(LocalFileHeader localFileHeader) throws java.io.IOException
- Throws:
java.io.IOException
-
getPasswordVerifier
private byte[] getPasswordVerifier() throws java.io.IOException
- Throws:
java.io.IOException
-
incrementAesByteBlockPointer
private void incrementAesByteBlockPointer(int incrementBy)
-
decrementRemainingAesBytesLength
private void decrementRemainingAesBytesLength(int decrementBy)
-
-