Unstructured-IO / Unstructured-IO/unstructured-api
ValueError: Invalid key size (104) for RC4.
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 951
- Forks
- 192
- Avg merge
- 7d 8h
- Merged PRs (30d)
- 2
Description
Related to the pdf.metadata line from https://github.com/Unstructured-IO/unstructured-api/pull/249
ValueError: Invalid key size (104) for RC4
...
File "prepline_general/api/general.py", line 607, in response_generator
response = pipeline_api(
File "prepline_general/api/general.py", line 281, in pipeline_api
pdf.metadata
File "pypdf/_reader.py", line 388, in metadata
obj = self.trailer[TK.INFO]
File "pypdf/generic/_data_structures.py", line 320, in __getitem__
return dict.__getitem__(self, key).get_object()
File "pypdf/generic/_base.py", line 312, in get_object
obj = self.pdf.get_object(self)
File "pypdf/_reader.py", line 1410, in get_object
retval = self._encryption.decrypt_object(
File "pypdf/_encryption.py", line 845, in decrypt_object
cf = self._make_crypt_filter(idnum, generation)
File "pypdf/_encryption.py", line 917, in _make_crypt_filter
stm_crypt = self._get_crypt(self.StmF, rc4_key, aes128_key, aes256_key)
File "pypdf/_encryption.py", line 934, in _get_crypt
return CryptRC4(rc4_key)
File "pypdf/_crypt_providers/_cryptography.py", line 43, in __init__
self.cipher = Cipher(ARC4(key), mode=None)
File "cryptography/hazmat/primitives/ciphers/algorithms.py", line 143, in __init__
self.key = _verify_key_size(self, key)
File "cryptography/hazmat/primitives/ciphers/algorithms.py", line 20, in _verify_key_size
raise ValueError(
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the traceback through prepline_general/api/general.py, especially pipeline_api and response_generator, then inspect pypdf/_reader.py, pypdf/_encryption.py, and pypdf/_crypt_providers/_cryptography.py around RC4 key construction. Done means the reported PDF metadata access no longer raises the invalid 104-bit RC4 key error, with the expected handling for that PDF established.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100