Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unsigning a signed jar

I am using bouncy castle provider for AES encryption. I need to create a fat jar from bc and my jar but as soon as i do it i get Algorithm not found exception. Is it possible to get rid of the sign and create regular jar out of it?

My build process is..

  • i unzip all jars in to my build directory.
  • then remove META-INF directory
  • compile my application
  • jar it using ant

iget the error when i try to use the

SecretKeyFactory.getInstance(algorithm);

algorithm is PBEWITHSHA256AND128BITAES-CBC-BC from bouncy castle.

like image 817
Hamza Yerlikaya Avatar asked Aug 18 '09 05:08

Hamza Yerlikaya


People also ask

How do I view a jar signing certificate?

Go to \binc. Run jarsigner -verify -verbose -certs . jard. Check the certificate's "valid from" date under the “CN=International Business Machines Corporation” section.

How do you check if a jar is corrupted?

On the command line, run the jar command like this: jar -tvf <jarname> . The 't' says "test", 'v' I believe means "verbose", and 'f' means "file". You can also open a JAR in any ZIP program.


2 Answers

To remove the signature from a jar file, remove the META-INF directory from it. A jar file is a zip file so on Linux you can do this:

zip -d file.jar 'META-INF/*.SF' 'META-INF/*.RSA'
like image 151
martinhans Avatar answered Oct 20 '22 11:10

martinhans


When you sign a jar file, new files get added to the META-INF directory, e.g. "MKSIGN.SF" and "MKSIGN.DSA". Just remove them from the jar file (with any zip utility), and you have it unsigned.

like image 27
Martin v. Löwis Avatar answered Oct 20 '22 12:10

Martin v. Löwis