views:

136

answers:

2

I want write my own ClassLoader. It should be faster and more dynamic as the default ClassLoader for Applets.

But I does not know how I should implements the method:

PermissionCollection getPermissions( CodeSource codesource )

The super implementation grant no rights also if there is a valid certificate in the CodeSource.

Must I verify the certificate self or is it already verifies form the Java VM and accepted from the User?

+1  A: 

The Sun PlugIn and WebStart override getPermissions to check the signature and check with the user whether they wish to accept the certificate. This is an implementation detail and may change in the future.

Tom Hawtin - tackline
+1  A: 

Correct me if I am wrong - I think what you want is to create a classloader somewhere in the initialization of your applet and then load your subsequent classes using that loader. If yes, the applet will already have been granted all permissions by virtue of it being signed (and provided the user clicked on the browser warning). Your getPermissions method can look like this

    PermissionCollection p = new Permissions();
    p.add(new AllPermission());
    return p;
talonx
Yes and No. The jar file with the classLoader was accepted and has all rights. This is not valid for the other jar files. This files can be manipulated. That this will be a security hole to accept all without checking it.
Horcrux7
That's right - but the Custom classloader is itself inside the trusted jar - so if it has been granted all permissions, logically those permissions should 'flow' to classes that it loads. But I get your point - the files can be manipulated only by hacking the JRE plugin itself.
talonx
As in, putting malicious versions of those classes in the parent loader (which is the plugin loader). But this also means that the client machine is compromised.
talonx