I have an applet, that does file signing using a certificate from smartcard, that means several extra permissions needed to get it working: loading .dll as file on local machine, creating temp files etc.
All involved jars are signed and started as Java Web Start.
I find confusing, that when full logic is called from init() method, everything works fine:
public void init() {
try {
File directory = new File("C:/Temp");
deployPKCS11Library(directory);
testFullCycleOnApplet("C:/somefile.txt");
} catch (Exception e) {
e.printStackTrace();
}
}
If I will take testFullCycleOnApplet
out of my init method and run it on button click after initialization, I will get:
java.security.AccessControlException: access denied ("java.util.PropertyPermission" "java.io.tmpdir" "read")
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
at java.lang.System.getProperty(Unknown Source)...
Does init method has more rights to perform restricted stuff ? In JNLP file I have set
<security>
<all-permissions />
</security>