Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8119899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:57:00+00:00 2026-06-06T04:57:00+00:00

I’ve coded a Java app and I plan to distribute it online. Each release

  • 0

I’ve coded a Java app and I plan to distribute it online. Each release will be locked with a secret serial key I made.

I need to secure my jar file from decompiler etc. Here is what I’ve done so far:

  1. User enters his serial key into a form
  2. The serial is sent to my dev server through a php script
  3. The script generates a new jar bin file which is encrypted in AES 128
  4. My “loader” downloads the jar file as bytes and decrypts it.
  5. It invokes the main method.
  6. User can use the app as he like to
  7. User close the app
  8. The cache is cleared and everything returns to step 1 or before.

I’ve made the steps 1 to 3, but I need to know if it is possible to make a custom classloader that grabs bytes from HTTP, decrypts them and invokes the main method. As the file is fully crypted (saved as bin on the PHP server), I can’t use a basic class loader. About step 8, is it possible to unload content from the computer’s memory?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T04:57:02+00:00Added an answer on June 6, 2026 at 4:57 am

    Yes, you can provide to a classloader the bytes you grab. I do it in a similar problem :

    public class SecureClassLoader extends URLClassLoader {
    
        @Override
        protected Class<?> findClass(final String name) throws ClassNotFoundException {
            if (isEncrypted(name)) {
                final String resourceName = name.replace('.', '/') + ".class";
                URL url = findResource(resourceName);
                if (url != null) {
                    byte[] classBytes = null;
                    try {
                        classBytes = EncryptionUtil.decryptBytes(url, key);
                        return defineClass(name, classBytes, 0, classBytes.length);
                    } catch (ClassFormatError e) {
                        log.severe("Bad format for decrypted class " + name);
                        throw new EncryptedClassNotFoundException(name, e);
                    } catch (InvalidKeyException e) {
                        throw new EncryptedClassNotFoundException(name, e);
                    } catch (IOException e) {
                        throw new EncryptedClassNotFoundException(name, e);
                    }
                }
            }
    
            // default loader
            try {
                return super.findClass(name);
            } catch (ClassNotFoundException e) {
                throw new EncryptedClassNotFoundException(name, e);
            }
        }
    
        private boolean isEncrypted(String className) {
            /// some things
        }
    }
    

    But this won’t be sufficient to protect your code. At the very least, don’t use the same bytes for two users (you seem to do it). And obfuscate your code (I use proguard). This will protect you against ordinary hackers, not the best ones.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I need a function that will clean a strings' special characters. I do NOT
I have thousands of HTML files to process using Groovy/Java and I need to
I am using Paperclip to handle profile photo uploads in my app. They upload
I am writing an app with both english and french support. The app requests
I would like to count the length of a string with PHP. The string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.