from googling.

"So seems like in Snow Leopard applets load via HTTP are not granted
to load keychain library, but applets load via HTTPS are."

so try it in tomcat with ssl perhaps?

On Fri, Mar 22, 2013 at 12:18 AM, Kurt T Stam <[email protected]> wrote:
> Hi Alex,
>
> I created the following applet:
>
> package org.apache.juddi.auth;
>
> import java.applet.Applet;
> import java.awt.Graphics;
> import java.security.KeyStore;
> import java.util.Enumeration;
>
> public class CertApplet extends Applet {
>     public void paint(Graphics g) {
>         System.out.println("hey");
>         g.drawRect(100, 100, 200, 200);
>         g.drawString("Hello world!", 100, 0);
>         try {
>             System.out.println("Hello keychain!");
>             KeyStore ks = KeyStore.getInstance("KeychainStore");
>             ks.load(null);
>             Enumeration<String> e = ks.aliases();
>             int y = 10;
>             while (e.hasMoreElements()) {
>                 String alias = e.nextElement();
>                 if (ks.isCertificateEntry(alias)) {
>                     System.out.printf("%s (certificate)\n", alias);
>                 } else if (ks.isKeyEntry(alias)) {
>                     System.out.printf("%s (key)\n", alias);
>                 } else {
>                     System.out.printf("%s (???)\n", alias);
>                 }
>             }
>         } catch (Exception e) {
>             e.printStackTrace();
>         }
>     }
> }
>
> and called it from
>
> <HTML>
> <HEAD>
> <TITLE> A Simple Program </TITLE>
> </HEAD>
> <BODY>
>
> Here is the output of my appletje:
> <APPLET CODE="org.apache.juddi.auth.CertApplet" WIDTH="250" HEIGHT="250"
> jar="hello.jar">
> </APPLET>
> </BODY>
> </HTML>
>
> And I self signed the jar. However the console says:
>
> basic: Applet started
> basic: Told clients applet is started
> hey
> java.security.AccessControlException: access denied
> ("java.lang.RuntimePermission" "useKeychainStore")
>     at
> java.security.AccessControlContext.checkPermission(AccessControlContext.java:366)
>     at
> java.security.AccessController.checkPermission(AccessController.java:560)
>     at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
>     at apple.security.KeychainStore.permissionCheck(KeychainStore.java:119)
>     at apple.security.KeychainStore.engineLoad(KeychainStore.java:723)
>     at java.security.KeyStoreSpi.engineLoad(KeyStoreSpi.java:384)
>     at java.security.KeyStore.load(KeyStore.java:1248)
>     at org.apache.juddi.auth.CertApplet.paint(CertApplet.java:16)
>
> From a test outside the browser this runs ok. Not sure the applet can get
> access to the keychainstore..
>
> --Kurt

Reply via email to