0

I am trying to change the ECParameters class in sun.security.ec. I need to do this in order to get arbitrary curves working, and I already downloaded the OpenJDK source, edited the code and compiled it again.

I unpacked my current rt.jar and replaced all the files in sun.security.ec with my own compiled files. Everything looks right, but when I compile it again and try to start netbeans nothing happens..

Does anyone know what I did wrong, and how I should do it properly?

Edit: I have read that it is not recommended to edit these classes, but this particular class even has a piece of code that is commented out.

// The code below is incomplete.
//It is left as a starting point for a complete parsing implementation.
Hendrik
  • 5,085
  • 24
  • 56
Tosjo
  • 1
  • 5
  • Why not package your implementation as a patch and submit it to the OpenJDK project? See http://openjdk.java.net/contribute/ for details. – Hendrik Oct 22 '15 at 08:05
  • *but when I compile it again and try to start netbeans nothing happens..* — You mean: Netbeans does not start? Or your program does not run? – Hendrik Oct 22 '15 at 08:05
  • I'm not that good of a java programmer yet I feel.. I'm actually a bit surprised that nobody did it already, since Elliptic Curve Cryptography is on the rise. – Tosjo Oct 22 '15 at 08:07
  • My netbeans won't even start, i'm running this on ubuntu 12.04. – Tosjo Oct 22 '15 at 08:09
  • Perhaps there is no corresponding bug. The first step to get this implemented in the JDK, is to file a bug report at http://bugreport.java.com Without a bug report, nothing will happen. Potentially ever. – Hendrik Oct 22 '15 at 08:09
  • I'd try to make sure that Netbeans uses an unpatched JDK... – Hendrik Oct 22 '15 at 08:10
  • Thanks! i'll file a bug report and hope they will do something with it. Since the same code is commented in java 6,7 and 8. Still I wonder if its possible to modify the rt.jar? I've tried adding my own .class file to it and it just made a different directory inside the jar, so it didn't change anything. But it IS possible to modify rt.jar somehow? But not I can't delete that particular directory anymore.. I'm a bit lost to speak the truth... – Tosjo Oct 22 '15 at 08:14

1 Answers1

0

It is not a good idea to change compiled JDK classes. Why you don't use "normal" ways to implement your case? As you already mentioned that it isn't a good way you could use the commented code you've found e.g. to implement an util class.

Julian L.
  • 401
  • 4
  • 12
  • I might try this as well, but I'm not sure how to make this work.. Since it appears to be quite hard to override classes from rt.jar . Maybe http://stackoverflow.com/a/30422178/5061639 might help me with trying this. – Tosjo Oct 22 '15 at 08:24
  • Well, overriding ECParameters will not work since the class is final. – Julian L. Oct 22 '15 at 08:49
  • I also forgot to mention that for example when using Keytool, it also uses that particular class. So it can not handle arbitrary curves, that's one of the reasons why I am opting to edit the class itself. – Tosjo Oct 22 '15 at 09:15