Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are signers of a class in Java?

Tags:

java

class

signer

The Class<?> class has a method public Object[] getSigners() whose JavaDoc is not so helpful in explaining what the method does; calling it on a couple of classes returned null for me.

Google only returned information about security exceptions, which did not mention about the signers of a class; I have seen there about this exceptions occurring when the same classes are loaded from multiple jars.

What exactly does the signer of a Java class represent? Is it some unique identifier provided by the JVM or by a tool when a Jar is signed?

There is tag for signer on StackOverflow but it's empty...

like image 620
Random42 Avatar asked Jun 19 '13 17:06

Random42


1 Answers

When you sign a .jar file in Java, the Toolsigner goes through it and recursively sign every file in the .jar. However, this is not limited to just one signer as you can sign a file with many different certificates. When you are verifying that a file is signed by the correct signer you can call the method getSigners() to return a list of all the signers who signed that class.

like image 103
Mitch Connor Avatar answered Sep 22 '22 05:09

Mitch Connor