Community   SpringSource   Projects    Downloads    Documentation    Forums    Training   Exchange   Blogs

Go Back   Spring Community Forums > Core Spring Projects > Core Container

Reply
 
Thread Tools Display Modes
  #1  
Old Feb 13th, 2006, 12:48 PM
cm sannies cm sannies is offline
Junior Member
 
Join Date: Feb 2006
Posts: 2
Default Spring and Obfuscationen

Hi,

my task is to remove the Spring Configuration XML to enable full obfuscation.
There are oviously 2 ways of doing so:
1. Rename all bean classes, etc. in the config file according to obfuscation. Hmm - I don't like that.
2. Do all application context definition in Java, so that the obfuscator can obfuscate the code. Is there a simple way? Implementing the WebApplicationContext does not seem a good idea. Using StaticWebApplicationContext is not intended as stated in javadoc, nevertheless it seems to be a possibility - a very complicated possibility.
Is there a way to instantiate a bunch of objects and make that bunch a applicationContext?
Or does anybody know a better possibility to use spring in conjunction with obfuscation?

Thanks in advance,
Sebastian
Reply With Quote
  #2  
Old Feb 13th, 2006, 01:04 PM
Kees de Kooter Kees de Kooter is offline
Senior Member
 
Join Date: Dec 2004
Location: Rotterdam, The Netherlands
Posts: 158
Default

I think the solution is to obfuscate the applicationcontext.xml as well. There are obfucation tools out there that can do that.
__________________
Kees de Kooter
www.boplicity.net
Reply With Quote
  #3  
Old Feb 13th, 2006, 06:25 PM
jbetancourt jbetancourt is offline
Senior Member
 
Join Date: Aug 2004
Location: u.s.a
Posts: 399
Default

You could have a bean, ObfuscatedApplicationLoader, that contains or loads a String that is encrypted or obfuscated. That String contains the application context definition. I think you can then create a resource of that String so that it can be loaded with one of the xml application context bean loaders.

Of course, this bean would not be part of any application context definition.
Reply With Quote
  #4  
Old Feb 13th, 2006, 06:50 PM
Cowboy Bob Cowboy Bob is offline
Senior Member
 
Join Date: Jul 2005
Posts: 246
Default

You do realise that obfuscation is a complete waste of time anyway? There are tools out there that will be able to decompile your code no matter what you do. Security by obscurity never works.
Reply With Quote
  #5  
Old Feb 14th, 2006, 05:05 AM
cm sannies cm sannies is offline
Junior Member
 
Join Date: Feb 2006
Posts: 2
Default

Cowboy Bob: You do realise that there are necessities beyond reason? My boss wants it - so the discussion is wasted time.

jbetancourt: Embed an encrypted applicationContext.xml into my application? Ok, but how do I get my classnames in that file obfuscated according to the obfuscation tool?

There comes Kees de Kooter: You tell me that there are tools that can obfuscate applicationContexts but can also tell me these tools' names? That would help a lot.

Thanks,
Sebastian
Reply With Quote
  #6  
Old Feb 14th, 2006, 06:01 AM
Kees de Kooter Kees de Kooter is offline
Senior Member
 
Join Date: Dec 2004
Location: Rotterdam, The Netherlands
Posts: 158
Default

Sorry Sebastian, didn't mention the name because I am not too keen on plugging commercial products. But this one seems to be free.

It is yGuard: http://www.yworks.com/en/products_yguard_about.htm
__________________
Kees de Kooter
www.boplicity.net
Reply With Quote
  #7  
Old Feb 14th, 2006, 06:20 AM
jbetancourt jbetancourt is offline
Senior Member
 
Join Date: Aug 2004
Location: u.s.a
Posts: 399
Default

At a prior company we looked at obfuscation. What a pain, and ultimately, as Cowboy Bob mentioned, not a foolproof way to protect code. I was surprised that even encryption of classes is also problematic. Also, if dynamic techniques such as reflection, aop, and class loading, not sure some things will not even work. Does not work with EJB, for example.
Reply With Quote
  #8  
Old Feb 14th, 2006, 07:13 AM
Costin Leau's Avatar
Costin Leau Costin Leau is offline
Spring DM Lead
Spring Modules TeamSpring Team
 
Join Date: Jan 2005
Location: Bucharest, Romania
Posts: 5,015
Default

I agree with jbetancourt - obfuscation doesn't work very well from my experience - the names of methods are changed and the appcontext and any other reflection mechanism has to be updated as well. There are some solutions out there which involve custom classloaders that can encrypt and decrypt class definitions once they are loaded but this is not an option once you have to supply your product packaged as a war/ear for usage on the client own server stack.
Moreover, we had to change the way we reported bugs and our logging messages since they didn't made any sense.
__________________
Costin Leau
SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
http://twitter.com/costinl
Please use [ c o d e ] [ / c o d e ] tags
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 11:01 AM.


Contegix provides first-class managed hosting and partial sponsorship of these forums.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.