user554712
user554712

Reputation: 211

Check Jar signer

I wrote a Java program and packed into a runnable jar. Then, I signed the jar.
How can the jar check by it self was signed by me? And ensure the jar was not changed by others.
I want to add some code into the main class of the jar to check the jar, instead of using jarsigner or other external tools.

Upvotes: 0

Views: 472

Answers (2)

Robert
Robert

Reputation: 42615

Verifying the class signatures is usually the job of the ClassLoader. You would have to implement your own ClassLoader which checks the code signature before loading it. A nice (but complex) example can be found O'Reilly's Java Security book.

Upvotes: 0

Erhan Bagdemir
Erhan Bagdemir

Reputation: 5327

i assume that you want to protect your code programmaticly. there is an another way to protect your java code. if i were you, i would look for open source java obfuscators on internet. Here would be a starting point for you:

http://java-source.net/open-source/obfuscators

Upvotes: 1

Related Questions