0 Replies Latest reply: Mar 13, 2012 11:05 AM by jvr968 RSS

    access denied to a security provider on a signed applet

    jvr968
      Hi,
      I'm having permissions problems to work with a security provider.

      The security provider is already installed at java.security. In fact, at Netbeans when debbuging the app it's working perfectly.

      If I'm working the provider in an signed applet, then there are errors.

      Even, I have created a .jar file and I have saved in the /ext directory, wich by default in the java.policy file has got all security permissions.

      grant codeBase "file:${{java.ext.dirs}}/*" {
      permission java.security.AllPermission;
      };

      Even with these granted permissions, I'm getting problems to work with the security provider that I have installed. Also, with these permissions I should be able to install the security provider.

      log:

      <record>
      <date>2012-03-13T12:13:39</date>
      <millis>1331637219126</millis>
      <sequence>17</sequence>
      <logger>appletpdf.appletPdf</logger>
      <level>SEVERE</level>
      <class>appletpdf.appletPdf</class>
      <method>applTest</method>
      <thread>11</thread>
      <message>excepcion: {0} </message>
      <exception>
      <message>java.security.AccessControlException: access denied (java.security.SecurityPermission authProvider.SunPKCS11-Provider-name)</message>
      <frame>
      <class>java.security.AccessControlContext</class>
      <method>checkPermission</method>
      <line>393</line>
      </frame>
      <frame>
      <class>java.security.AccessController</class>
      <method>checkPermission</method>
      <line>553</line>
      </frame>
      <frame>
      <class>java.lang.SecurityManager</class>
      <method>checkPermission</method>
      <line>549</line>
      </frame>
      <frame>
      <class>net.sourceforge.jnlp.runtime.JNLPSecurityManager</class>
      <method>checkPermission</method>
      <line>250</line>
      </frame>
      <frame>
      <class>sun.security.pkcs11.SunPKCS11</class>
      <method>login</method>
      <line>1036</line>
      </frame>
      <frame>
      <class>sun.security.pkcs11.P11KeyStore</class>
      <method>login</method>
      <line>874</line>
      </frame>
      <frame>
      <class>sun.security.pkcs11.P11KeyStore</class>
      <method>engineLoad</method>
      <line>764</line>
      </frame>
      <frame>
      <class>java.security.KeyStore</class>
      <method>load</method>
      <line>1201</line>
      </frame>
      <frame>
      <class>apppdf.appPdf</class>
      <method>tPKCS11</method>
      <line>174</line>
      </frame>
      <frame>
      <class>appletpdf.appletPdf</class>
      <method>applTest</method>
      <line>137</line>
      </frame>
      <frame>
      <class>appletpdf.appletPdf</class>
      <method>initapplDPdf</method>
      <line>116</line>
      </frame>
      <frame>
      <class>sun.reflect.NativeMethodAccessorImpl</class>
      <method>invoke0</method>
      </frame>
      <frame>
      <class>sun.reflect.NativeMethodAccessorImpl</class>
      <method>invoke</method>
      <line>57</line>
      </frame>
      <frame>
      <class>sun.reflect.DelegatingMethodAccessorImpl</class>
      <method>invoke</method>
      <line>43</line>
      </frame>
      <frame>
      <class>java.lang.reflect.Method</class>
      <method>invoke</method>
      <line>616</line>
      </frame>
      <frame>
      <class>sun.applet.PluginAppletSecurityContext$4</class>
      <method>run</method>
      <line>699</line>
      </frame>
      <frame>
      <class>java.security.AccessController</class>
      <method>doPrivileged</method>
      </frame>
      <frame>
      <class>sun.applet.PluginAppletSecurityContext</class>
      <method>handleMessage</method>
      <line>696</line>
      </frame>
      <frame>
      <class>sun.applet.AppletSecurityContextManager</class>
      <method>handleMessage</method>
      <line>69</line>
      </frame>
      <frame>
      <class>sun.applet.PluginStreamHandler</class>
      <method>handleMessage</method>
      <line>273</line>
      </frame>
      <frame>
      <class>sun.applet.PluginMessageHandlerWorker</class>
      <method>run</method>
      <line>82</line>
      </frame>
      </exception>
      </record>


      Fails in the line where the KeyStore is loading:(Pin is correct)

      KeyStore myKeyStore=null;
      Provider p = Security.getProvider("SunPKCS11-Provider-Name");
      myKeyStore = KeyStore.getInstance("PKCS11",p);
      char[] pinData = pin.toCharArray();
      myKeyStore.load(null, pinData);

      Any help would be apreciated.
      Thank you.
      Bye