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