PrivilegedActionException error in applet. Unsigned applet.

Hi there!

I have some problems testing a signing applet I'm developing. Everytime I make a change I have to export from Eclipse and sing the applet. This is really a pain.

I decided to debug directly from the harddisk, so I created a webpage with file:// links instead of normal http://

Ok the problem is that the applet is currently working, but fails on sign. This is because the applet is not signed (just a bunch of .class files). So I edited the user java.policy to grant all.

But it does not work...

Here is the output:

Cut here -

Java (TM) Plug-in: Versi髇 1.4.2

Usar versi髇 JRE 1.4.2-03 Java HotSpot(TM) Client VM

Directorio local del usuario = /home/gad

-

c:borrar ventana de consola

f:finalizar objetos en la cola de finalizaci髇

g:liberaci髇 de recursos

h:presentar este mensaje de ayuda

l:volcar lista del cargador de clases

m:imprimir sintaxis de memoria

o:activar registro

p:recargar configuraci髇 delegada

q:ocultar consola

r:recargar configuraci髇 de norma

s:volcar propiedades del sistema

t:volcar lista de subproceso

v:volcar pila de subprocesos

x:borrar antememoria del cargador de clases

0-5: establecer nivel de rastreo a <n>

-

JavaScript: UniversalBrowserRead habilitado

JavaScript: UniversalJavaPermission habilitado

java.security.PrivilegedActionException: java.lang.reflect.InvocationTargetException

at java.security.AccessController.doPrivileged(Native Method)

at sun.plugin.liveconnect.SecureInvocation$2.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)

at sun.plugin.liveconnect.SecureInvocation.CallMethod(Unknown Source)

at sun.plugin.navig.motif.AThread.handleRequest(Native Method)

at sun.plugin.navig.motif.AThread.JNIHandleLoop(Unknown Source)

at sun.plugin.navig.motif.AThread.run(Unknown Source)

Caused by: java.lang.reflect.InvocationTargetException

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at sun.plugin.javascript.invoke.JSInvoke.invoke(Unknown Source)

at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at sun.plugin.javascript.JSClassLoader.invoke(Unknown Source)

at sun.plugin.liveconnect.PrivilegedCallMethodAction.run(Unknown Source)

... 7 more

Caused by: com.seglan.signing.exceptions.KeyStoreException: El KeyStore no fue inicializado, quiz?hubo un error en el sistema.

at com.seglan.firmador.DigitalSignerApplet.signDocument(DigitalSignerApplet.java:161)

... 17 more

JavaScript: UniversalBrowserRead habilitado

JavaScript: UniversalJavaPermission habilitado

JavaScript: UniversalBrowserRead habilitado

JavaScript: UniversalJavaPermission habilitado

JavaScript: UniversalBrowserRead habilitado

JavaScript: UniversalJavaPermission habilitado

java.lang.IllegalArgumentException: null source

at java.util.EventObject.<init>(Unknown Source)

at java.awt.AWTEvent.<init>(Unknown Source)

at java.awt.event.ComponentEvent.<init>(Unknown Source)

at java.awt.event.WindowEvent.<init>(Unknown Source)

at java.awt.event.WindowEvent.<init>(Unknown Source)

at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)

at java.awt.Component.dispatchEventImpl(Unknown Source)

at java.awt.Container.dispatchEventImpl(Unknown Source)

at java.awt.Window.dispatchEventImpl(Unknown Source)

at java.awt.Component.dispatchEvent(Unknown Source)

at java.awt.EventQueue.dispatchEvent(Unknown Source)

at java.awt.SequencedEvent.dispatch(Unknown Source)

at java.awt.EventQueue.dispatchEvent(Unknown Source)

at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.run(Unknown Source)

java.lang.IllegalArgumentException: null source

at java.util.EventObject.<init>(Unknown Source)

at java.awt.AWTEvent.<init>(Unknown Source)

at java.awt.event.ComponentEvent.<init>(Unknown Source)

at java.awt.event.WindowEvent.<init>(Unknown Source)

at java.awt.event.WindowEvent.<init>(Unknown Source)

at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)

at java.awt.Component.dispatchEventImpl(Unknown Source)

at java.awt.Container.dispatchEventImpl(Unknown Source)

at java.awt.Window.dispatchEventImpl(Unknown Source)

at java.awt.Component.dispatchEvent(Unknown Source)

at java.awt.EventQueue.dispatchEvent(Unknown Source)

at java.awt.SequencedEvent.dispatch(Unknown Source)

at java.awt.EventQueue.dispatchEvent(Unknown Source)

at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.run(Unknown Source)

Cut here -

Ok, my java policy is located at: /home/gad/.java/deployment/security/java.policy

Cut here -

deployment.user.cachedir = /home/gad/.java/deployment/cache

deployment.user.certs = /home/gad/.java/deployment/security/deployment.certs

deployment.user.extdir = /home/gad/.java/deployment/ext

deployment.user.home = /home/gad/.java/deployment

deployment.user.jssecerts = /home/gad/.java/deployment/security/deployment.jssecerts

deployment.user.logdir = /home/gad/.java/deployment/log

deployment.user.profile = /home/gad

deployment.user.security.policy = file:/home/gad/.java/deployment/security/java.policy

deployment.user.tmpdir = /home/gad/.java/deployment/cache/tmp

Cut here -

and looks like:

Cut here -

grant {

permission java.security.AllPermission;

};

Cut here -

And the millon dollar question is:

縃ow can I run the applet from mozilla with all permissions?

It's using bouncy castle as a .jar library

Any help on this.

[6789 byte] By [gad@seglana] at [2007-10-3 0:02:05]
# 1

And again, the code is working properly...

Just forgot to look at the real problem. I will explain so others can take advantage of this.

The exception I posted is thelling you where the problem is:

Cut here -

Caused by: com.seglan.signing.exceptions.KeyStoreException: El KeyStore no fue inicializado, quiz?hubo un error en el sistema.

at com.seglan.firmador.DigitalSignerApplet.signDocument(DigitalSignerApplet.java:161)

Cut here -

So I looked at the line and realized that a internal call is missing. The KeyStore was not correctly intialized. This caused an exception that caused others...

Corrected this, corrected everything.

After some warinings about java.policy:

Cut here -

log4j:WARN Please initialize the log4j system properly.

JavaScript: llamada de c骴igo del sistema Java

JavaScript: norma de seguridad predeterminada = file://

JavaScript: llamada de c骴igo del sistema Java

JavaScript: norma de seguridad predeterminada = file://

JavaScript: llamada de c骴igo del sistema Java

JavaScript: norma de seguridad predeterminada = file://

JavaScript: llamada de c骴igo del sistema Java

JavaScript: norma de seguridad predeterminada = file://

JavaScript: llamada de c骴igo del sistema Java

JavaScript: norma de seguridad predeterminada = file://

JavaScript: llamada de c骴igo del sistema Java

JavaScript: norma de seguridad predeterminada = file://

JavaScript: llamada de c骴igo del sistema Java

Cut here -

It's working everything.

gad@seglana at 2007-7-14 16:49:42 > top of Java-index,Security,Signed Applets...