Question for programmers/Computer scientists.

This topic is locked from further discussion.

Avatar image for RadecSupreme
RadecSupreme

4824

Forum Posts

0

Wiki Points

0

Followers

Reviews: 8

User Lists: 0

#1  Edited By RadecSupreme
Member since 2009 • 4824 Posts

I am a computer science major working on my Bachelor's degree and wanted to ask a question on programming if anyone could kindly help.

Is there a way to protect a specific piece of code in a Java program using Netbeans so that if a person who is using the program wants to dissect the code, he will not see a specific part of that code.

Avatar image for GazaAli
GazaAli

25216

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#2 GazaAli
Member since 2007 • 25216 Posts

My knowledge in java has been rendered rusty but I believe setting the class as private will achieve that end.

Avatar image for RadecSupreme
RadecSupreme

4824

Forum Posts

0

Wiki Points

0

Followers

Reviews: 8

User Lists: 0

#3 RadecSupreme
Member since 2009 • 4824 Posts

@GazaAli: Yea, that's the thing. I know that one can make classes and methods private, but how does one do it so you can hide code, even when looking at it through an IDE?

Avatar image for johnd13
johnd13

11125

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#4 johnd13
Member since 2011 • 11125 Posts

Sorry, can't help you. I never had to "lock" my code.

Avatar image for RadecSupreme
RadecSupreme

4824

Forum Posts

0

Wiki Points

0

Followers

Reviews: 8

User Lists: 0

#5 RadecSupreme
Member since 2009 • 4824 Posts

Well that's unfortunate.

Avatar image for Nick3306
Nick3306

3429

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#6  Edited By Nick3306
Member since 2007 • 3429 Posts

@RadecSupreme: I don't understand, you want to give them the source code by make it so they cant view all of it? What is the point of that?

Avatar image for XaosII
XaosII

16705

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#7 XaosII
Member since 2003 • 16705 Posts

What you are looking for is called code obfuscation. If you are looking to do it in Java using Netbeans, then im sure theres likely some kind of tool or utility that can help in automatically obfuscating your code.

Keep in mind that the code obfuscation concept is called "security by obscurity" and its generally considered one of the weakest forms of security. This is also partly related to why no one has yet to create any kind of DRM on executable files that is effective on a PC. The user running the code has access to both the code and the keys to unlock (or decrypt) whatever form of security you have.

Avatar image for RadecSupreme
RadecSupreme

4824

Forum Posts

0

Wiki Points

0

Followers

Reviews: 8

User Lists: 0

#8 RadecSupreme
Member since 2009 • 4824 Posts

@Nick3306: No, I want to give them the program, but I want to make it so that if someone tries to dissect the code, they can not see part of the code.

@XaosII: Thank you for this information. Is there a better form of security out there to protect code?

Avatar image for XaosII
XaosII

16705

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#9 XaosII
Member since 2003 • 16705 Posts

@RadecSupreme said:

@Nick3306: No, I want to give them the program, but I want to make it so that if someone tries to dissect the code, they can not see part of the code.

@XaosII: Thank you for this information. Is there a better form of security out there to protect code?

Yeah. Dont give them access to it. its one of the reasons why cloud computing, online services, and SaaS have become so popular. The core code of whatever your product or service does is hosted somewhere else and a website (or desktop client) just accesses that information.

If you need to create a desktop application, theres a few options though they are all a bit complicated:

  • Obfuscate your code: this is weak and is a best a minor inconvenience to someone who really wants to look at it.
  • Asymmetric encryption of product licenses: your product needs a license to function that is generated (likely by your own website) to function.
  • Use a content packing tool: The exe does little more than pack and unpack classes and objects. The packed classes/objects are likely compressed in a binary format thats makes it hard to tell what is data and what are lines of code. Several companies provide solutions.
  • Create a custom packer: Like the option above but more difficult. A proprietary file format with your own encryption, compression, and code for packing and depacking can make it difficult, but not impossible.

In short, there is no guaranteed way to protect your code as long as the user has access to it on their PC.

Avatar image for Nick3306
Nick3306

3429

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#10 Nick3306
Member since 2007 • 3429 Posts

@RadecSupreme said:

@Nick3306: No, I want to give them the program, but I want to make it so that if someone tries to dissect the code, they can not see part of the code.

@XaosII: Thank you for this information. Is there a better form of security out there to protect code?

Ah, the with the way you said "a specific piece of code", it seemed like you wanted them to be able to see the code but not a certain part of it, my bad.