net.i2p.crypto
Class AESInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
net.i2p.crypto.AESInputStream
- All Implemented Interfaces:
- java.io.Closeable
public class AESInputStream
- extends java.io.FilterInputStream
This reads an underlying stream as written by AESOutputStream - AES256 encrypted
in CBC mode with PKCS#5 padding, with the padding on each and every block of
16 bytes. This minimizes the overhead when communication is intermittent,
rather than when streams of large sets of data are sent (in which case, the
padding would be on a larger size - say, 1k, though in the worst case that
would have 1023 bytes of padding, while in the worst case here, we only have
15 bytes of padding). So we have an expansion factor of 6.25%. c'est la vie
Fields inherited from class java.io.FilterInputStream |
in |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AESInputStream
public AESInputStream(I2PAppContext context,
java.io.InputStream source,
SessionKey key,
byte[] iv)
read
public int read()
throws java.io.IOException
- Overrides:
read
in class java.io.FilterInputStream
- Throws:
java.io.IOException
read
public int read(byte[] dest)
throws java.io.IOException
- Overrides:
read
in class java.io.FilterInputStream
- Throws:
java.io.IOException
read
public int read(byte[] dest,
int off,
int len)
throws java.io.IOException
- Overrides:
read
in class java.io.FilterInputStream
- Throws:
java.io.IOException
skip
public long skip(long numBytes)
throws java.io.IOException
- Overrides:
skip
in class java.io.FilterInputStream
- Throws:
java.io.IOException
available
public int available()
throws java.io.IOException
- Overrides:
available
in class java.io.FilterInputStream
- Throws:
java.io.IOException
close
public void close()
throws java.io.IOException
- Specified by:
close
in interface java.io.Closeable
- Overrides:
close
in class java.io.FilterInputStream
- Throws:
java.io.IOException
mark
public void mark(int readLimit)
- Overrides:
mark
in class java.io.FilterInputStream
reset
public void reset()
throws java.io.IOException
- Overrides:
reset
in class java.io.FilterInputStream
- Throws:
java.io.IOException
markSupported
public boolean markSupported()
- Overrides:
markSupported
in class java.io.FilterInputStream
remainingBytes
int remainingBytes()
readyBytes
int readyBytes()
main
public static void main(java.lang.String[] args)
- Test AESOutputStream/AESInputStream