感谢Richard,Simon,Mark Myers和giulio提出的问题。
我终于得到全面理解的Mikkel的文章(通过读取它 慢)上:
http://lekkimworld.com/2013/06/20/java_in_notes_domino_explained_on_java_security_and_how_it_relates_to_notes_domino.html
解决方案比我想象的要容易,我对反射示例感到困惑。
比修改java.policy文件(我没有管理,顺便说一句),这是一种更为优雅的方法。
我通过添加新的方法dopriviledgeddecrypt()来修改正在创建麻烦的类,该类正在调用其crypto()方法,该方法是引发麻烦的方法的狡猾包装器。然后,我将所有调用者都修改为PDFDecryptor.decrypt(),以便他们调用PDFDecryptor.dopriviledgeddecrypt()。最后一步涉及将整个类导出到jar文件,然后将其放置在您正在开发的计算机上(在客户端中)和将运行此代码的所有服务器上的\ jvm \ lib \ ext文件夹中。
我也无法确定是否存在用于修改java.policy文件的语法,以使其仅影响单个Notes数据库。(更新:我现在知道这是不可能的)
package com.magerman.hremail.prep1docc;
public class PDFDecryptor {
/**
* Instantiates a new pDF decryptor.
*
* @param inputFile
* the input file
* @param inputPassword
* the input password
*/
public PDFDecryptor(final File inputFile, final String inputPassword) {
originalFile = inputFile;
password = inputPassword;
}
/**
* Decrypt. Given an inputted PDF File, will try to remove the security of
* the PDF and save in-place. Done after the attachments have been extracted
*/
public final void decrypt() {
// naughty code here
}
public final void doproviledgeddecrypt() throws Exception {
AccessController.doPrivileged(new PrivilegedExceptionAction() {
public Object run() throws Exception {
PDFDecryptor.this.decrypt();
return null;
}
});
}
}