Requirement is to process a batch of PDF\'s one at a time and on success encrypt each of them with an user password.
However, these PDF\'s were encrypted previously
PdfReader has an undocumented static boolean variable named unethicalreading. For obvious reasons, this variable is set to false by default. You could set this variable to true like this:
PdfReader.unethicalreading = true;
From now on, PdfReader will ignore the presence of an owner password. It will only throw an exception if a user password is in place.
Use this at your own risk.