Hi,
I've been busy trying to fix it myself. Made some progress. Fixed the 40bit implementation for a start, so now user and owner passwords can be different! (meaning you can actually make use of the user permissions now), I've also managed to get 128bit encryption being written and reread by the library (I can extract text from pages faithfully), but so far Adobe Reader accepts the passwords but displays a blank page... I'm close!
Basically how I tackled it was to go back to the pdf spec and implement each algorithm 3.1 - 3.7 as the spec describes it. One thing I noticed was you don't implement step 4 or 3.5 in your code (you do the xor on the key for all 20 RC4 calls). I was doing this, but Reader wouldn't accept the passwords. I swapped back in your _compute_u sub and it accepted the passwords (but displayed a blank page..). I'll send you my code.
(3)
]
