Class 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 Details

  • Constructor Details

    • 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:
      IOException
      NoSuchAlgorithmException
  • Method Details

    • read

      public int read(byte[] buffer, int size) throws IOException
      Overrides:
      read in class ASBufferedInFilter
      Throws:
      IOException
    • read

      public int read(byte[] buffer, int off, int size) throws IOException
      Overrides:
      read in class InputStream
      Throws:
      IOException
    • reset

      public void reset() throws IOException
      Overrides:
      reset in class ASBufferedInFilter
      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.