# Exception while generating keys in applets

heiko.grussbach@crpht.lu
Wed, 23 Sep 1998 16:45:15 +0200

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: hcsoft@image.dk: "SecurityException"
- Previous message: David HANNAPPE: "Signed applet problem"

I am writing an applet for a login procedure. In the applet, I want to
generate a signature on an object before I send it to the server, so that
the server can verify the object. Now there are 2 possibilities, either

1) use something like keytool (JDK1.2 beta4) to generate keys, store them
in the personal keystore and then access them from the applet. This would
however involve giving the applet file read access. Still, this might by a
good solution, since key generation takes quite a bit of CPU-time.

2) create the keys in the applet. I've tried this, it worked in a very
simple applet (just an init method doing the key generation), but it
doesn't work with a more complicated applet (i.e. a few buttons, labels and
an ActionListener). When I try to generate the keys, I get the following
(everything JDK 1.2 beta4, appletviewer):

Exception occurred during event dispatching.
java.lang.ExceptionInInitializerError:
java.security.AccessControlException: access denied
(java.lang.RuntimePermission modifyThread)
...
at sun.security.provider.genSeed(SeedGenerator.java:161)
at sun.security.provider.setSleepTime(SeedGenerator.java:60)
...
at
sun.security.provider.DSAKeyPairGenerator.generateKeyPair(DSAKeyPairGenerat
or.java:161)
...
the event (a push to a button), that should initiate the key generation
(something like onButtonBushed())

Now, when I generate the keys outside of an event, for example in the init
method of the applet, it works fine. Is this a bug, or expected?

Regards
Heiko

Heiko.Grussbach@crpht.lu

- Next message: hcsoft@image.dk: "SecurityException"
- Previous message: David HANNAPPE: "Signed applet problem"