java - Reading file from JApplet -
i need read certificate file (private.der
) japplet create privatekey rsa, getting error
access denied ("java.io.filepermission" "private.der" "read")
i have learned japplet running in sandbox , can't access files long not assigned. correct me if wrong.
i signed , worked:
keytool -genkey -keyalg rsa -alias mykeyname keytool -export -alias mykeyname -file mycertname.crt jarsigner "rsa.jar" mykeyname
but still error filepermission
error.
java code
file f = new file("private.der"); fileinputstream fis = new fileinputstream(f); datainputstream dis = new datainputstream(fis); byte[] keybytes = new byte[(int) f.length()]; dis.readfully(keybytes); dis.close(); pkcs8encodedkeyspec spec = new pkcs8encodedkeyspec(keybytes); keyfactory kf = keyfactory.getinstance("rsa"); privatekey key = kf.generateprivate(spec);
if there flag / parameter disabling sandbox in google chrome, please give me. testing anyway --allow-file-access-from-files --disable-web-security
, because of same origin policy.
signing applet serves to:
a) identify provider (usually better certificate ca).
b) ensure content has not been modified else.
by itself, gives no security permissions. need grant applets signed permissions require in security policy file.
this link bit old explains process well. http://www.pawlan.com/monica/articles/signedapps/
oracle references points java web start applications instead of applets kind of issues, might explore it. http://docs.oracle.com/javase/tutorial/deployment/applet/security.html
oh, , way, these checks internal jvm, doubt there flag/configuration disable in browser.
Comments
Post a Comment