在尝试使用PDFBox解密加密的PDF时,我遇到了一个异常-
java.lang.ArrayIndexOutOfBoundsException
at java.lang.System.arraycopy(Native Method)
at org.apache.pdfbox.pdfmodel.encryption.StandardSecurityHandler.computeEncryptedKey
at org.apache.pdfbox.pdfmodel.encryption.StandardSecurityHandler.computeUserPassword
我使用的代码是
PDDocument doc = PDDocument.load(file);
if (doc.isEncrypted()) {
StandardDecryptionMaterial dm = new StandardDecryptionMaterial(password);
doc.openProtection(dm);
}
我也试过了,博士。解密方法,但结果相同。
我的maven包含
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>1.8.13</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15</artifactId>
<version>1.44</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcmail-jdk15</artifactId>
<version>1.44</version>
</dependency>
Java版本为1.7
我在一个Spring Boot应用程序中使用它-这可能是一个原因吗?