开发者

Self Signed Applet Can it access Local File Systems

开发者 https://www.devze.com 2022-12-23 16:25 出处:网络
Hi I have created a Self Signed Applet , but not able to access local files 开发者_JS百科system .What have i to do ?you need to wrap your IO code inside PrivilegedAction.

Hi I have created a Self Signed Applet , but not able to access local files 开发者_JS百科system .What have i to do ?


you need to wrap your IO code inside PrivilegedAction.

Generally, you need to sign your applet with your test certificate, the user will see a warning and will have to accept the certificate when it loads the applet.

then you need to wrap your code inside a PriviligedAction. see this for some examples.


The below code is use to Add a Bouncy Castle Jar, the same way you can use it for accessing the file. AccessController java api is used.

AccessController.doPrivileged(new PrivilegedAction() {          
  public Object run() {
    try{
      Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());      // Here you can write the code for File Accesss
    }catch (Exception e) {
      return "";
    }
    return "";
  }
}); 
0

精彩评论

暂无评论...
验证码 换一张
取 消