Package org.verapdf.cos.filters
Class COSFilterRC4DecryptionDefault
- java.lang.Object
-
- java.io.InputStream
-
- org.verapdf.as.io.ASInputStream
-
- org.verapdf.as.filters.ASInFilter
-
- org.verapdf.as.filters.io.ASBufferedInFilter
-
- org.verapdf.cos.filters.COSFilterRC4DecryptionDefault
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class COSFilterRC4DecryptionDefault extends ASBufferedInFilter
Filter that decrypts data using RC4 cipher decryption according to Algorithm 1 of 7.6.2 of ISO 32000:2008.- Author:
- Sergey Shemyakov
-
-
Field Summary
Fields Modifier and Type Field Description static intMAXIMAL_KEY_LENGTH-
Fields inherited from class org.verapdf.as.filters.io.ASBufferedInFilter
BF_BUFFER_SIZE, buffer, START_BUFFER_SIZE
-
Fields inherited from class org.verapdf.as.io.ASInputStream
isClosed, isSourceClosed, resourceUsers
-
-
Constructor Summary
Constructors Constructor Description COSFilterRC4DecryptionDefault(ASInputStream stream, COSKey objectKey, byte[] encryptionKey)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static byte[]getObjectKeyDigest(COSKey objectKey)Gets a byte string consisting of object number and object generation concatenated.intread(byte[] buffer, int size)intread(byte[] buffer, int off, int size)voidreset()-
Methods inherited from class org.verapdf.as.filters.io.ASBufferedInFilter
addToBuffer, bufferPop, bufferPopArray, bufferSize, closeResource, concatenate, feedBuffer, getBufferBegin, getBufferCapacity, getBufferEnd, getReadCounter, getStream, getStreamUntilToken, initialize, isEOF, peek, peek, processBuffer, read, readByte, resetReadCounter, skip, unread, unread
-
Methods inherited from class org.verapdf.as.filters.ASInFilter
close, decrementResourceUsers, getInputStream, incrementResourceUsers, read, setInputStream
-
Methods inherited from class org.verapdf.as.io.ASInputStream
createStreamFromStream
-
Methods inherited from class java.io.InputStream
available, mark, markSupported, nullInputStream, readAllBytes, readNBytes, readNBytes, skip, transferTo
-
-
-
-
Field Detail
-
MAXIMAL_KEY_LENGTH
public static final int MAXIMAL_KEY_LENGTH
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
COSFilterRC4DecryptionDefault
public COSFilterRC4DecryptionDefault(ASInputStream stream, COSKey objectKey, byte[] encryptionKey) throws IOException, NoSuchAlgorithmException
Constructor.- Parameters:
stream- is stream with encrypted data.objectKey- contains object and generation numbers from object identifier for object that is being decrypted. If it is direct object, objectKey is taken from indirect object that contains it.encryptionKey- is encryption key that is calculated from user password and encryption dictionary.- Throws:
IOExceptionNoSuchAlgorithmException
-
-
Method Detail
-
read
public int read(byte[] buffer, int size) throws IOException- Overrides:
readin classASBufferedInFilter- Throws:
IOException
-
read
public int read(byte[] buffer, int off, int size) throws IOException- Overrides:
readin classInputStream- Throws:
IOException
-
reset
public void reset() throws IOException- Overrides:
resetin classASBufferedInFilter- Throws:
IOException
-
getObjectKeyDigest
public static byte[] getObjectKeyDigest(COSKey objectKey)
Gets a byte string consisting of object number and object generation concatenated.- Parameters:
objectKey- is key of object.- Returns:
- byte string consisting of object number and object generation concatenated.
-
-