Complie time using custom classloader for decryption.

I need to decrypt several class during compile time, but my custom classloader could load everything except my encrypted classes.
Here is my sample code and how I test it.
Test.java:
public class Test {
     public Test(){
          System.out.println("test");
     public void hello(){
          System.out.println("hello");
Test1.java
public class Test1 extends java.lang.Test{
     public Test1(){
          System.out.println("test1");
     public static void main(String[] args){
          new Test1().hello();
#EncryptedClassLoader will print out the class name it trying to load, for example: "load class: java.lang.System"
1. Compile Test.java file and have it encrypted, make it into a jar file - test.jar.
2. Compile Test1.java file and try to run Test1.class with encrypted Test.class file using :
C:\lib>java -Djava.system.class.loader=EncryptedClassLoader -classpath c:\lib;c:\lib\tools.jar;c:\lib\test.jar Test1
Gives the output:
load class: java.lang.System
load class: java.nio.charset.Charset
load class: java.lang.String
load class: Test1
load class: Test
load class: sun.security.provider.Sun
load class: sun.security.rsa.SunRsaSign
load class: com.sun.net.ssl.internal.ssl.Provider
load class: com.sun.crypto.provider.SunJCE
load class: java.lang.Object
load class: java.io.PrintStream
test
test1
hello
So now I'm sure there's no problem with my EncryptedClassLoader
3. Try to compile Test1.java with the encrypted Test.class in test.jar(These's no Test.java file in the same folder) by using:
C:\lib>javac -J-Djava.system.class.loader=EncryptedClassLoader -J-classpath -J.;c:\lib;c:\lib\tools.jar;c:\lib\test.jar Test1.java
Give the output:
.............. (loading several system classes)
load class: com.sun.tools.javac.util.Position
Test1.java:4: cannot find symbol
symbol: class Test
public class Test1 extends Test{
^
load class: java.lang.Long
load class: java.io.DataInputStream
load class: com.sun.tools.javac.jvm.ClassReader$AnnotationCompleter
load class: com.sun.tools.javac.jvm.ClassReader$AnnotationDeproxy
load class: com.sun.tools.javac.jvm.ClassReader$ProxyVisitor
load class: com.sun.tools.javac.code.Types$SubstFcn
load class: com.sun.tools.javac.code.BoundKind
load class: java.lang.StringBuffer
Test1.java:12: cannot find symbol
symbol : method hello()
location: class Test1
new Test1().hello();
^
2 errors
---> from the output I found that Test.class never visited/loaded by my EncryptedClassLoader
Though I set EncryptedClassLoader as the default system classloader but it seems to load everything except my encrypted class.
Does anyone know why it works like this??
Thank you in advanced,
Alex.
null

I don't know why he was specifying the javac classpath like that instead of using javac's -classpath option.
But this whole business of decrypting class loades is pretty much a waste of time. It adds a layer of comfort but it's not really what I would call secure. At some point the unencrypted bytes have to appear in memory and from that point the classes are no longer secure.
The best protection against software piracy is not anti-decompilation techniques but time-to-market and pricing your product so that buying it is cheaper than reverse-engineering it.

Similar Messages

  • I want to set Firefox to never remember history. When I do this using the tools tab and click okay, it goes right back to "Use Custom Settings for History". I don't want that.

    I know how to manage privacy using the tools tab at the top of the address bar, or so I thought. I want to choose "Never Remember History". When I do that, and click "OK", the next time I check the privacy settings, the history is right back to "Use custom settings for history". I don't want this. Also, I don't want to use autocomplete for forms, but I can't get those settings to stay, either. I basically don't want info. stored on this computer. My system was hacked several months ago, by some joker who named all my system folders a racist slur (I reported it to Norton, and a technician had a look at it). Anyway, I want to keep things as safe as possible. Please allow me to delete all my history when I close Firefox. I don't really like Google, either, because they have a reputation for not respecting people's privacy. I don't like that I didn't have an option to uncheck google's toolbar when I installed Firefox.
    Thank you.

    That is probably OK.<br />
    You may have changed one of the other history or cookie settings.
    If Firefox shows the "Use custom settings for history" setting then that is an indication that at least one of the history and cookie settings are not the default to make you aware that changes were made.

  • Cannot change setting in privacy from remember history to use custom settings for history. I can set in to change but on closing with the ok button thus closing the privacy tab, it then reverts back to remember history.

    I have been by a web sit that the cookies are disabled in the browser. on looking at the help on firefox help the instuction as i understand was to change the setting under the privacy tab ref history fromthe default setting of rember hhistory to use custom settings for history. I change the setting click ok but it reverts back to rember history. I just cannot change the setting.This also happend in the prevous version.

    To see History and Cookie settings in Tools > Options > Privacy, choose the setting <b>Firefox will: Use custom settings for history</b>
    You need to make at least one change to make "Use Custom settings" stay selected.
    If all history settings are the default then the History and Cookie setting revert to "Remember history" the next time you open Tools > Options > Privacy.
    So it looks that your cookie setting are already correct.
    * http://kb.mozillazine.org/Cookies
    * http://kb.mozillazine.org/Websites_report_cookies_are_disabled

  • Even though I set "Use custom settings for history" when I close the window and recheck it has set itself back to "Rember History"..why?

    I am having trouble getting the settings to stay and can't figure out why...no matter what I do it just resets every time back to the
    "Remember History" and it won't save passwords on some of my sites.

    Firefox shows the "(Never) Remember history" choice if all the history and cookie setting are the default.<br />
    Make at least one change to the default setting if you want "Use custom settings for history" to stay selected.<br />
    Otherwise Firefox will revert to "(Never) Remember history" if you return to the Privacy tab.<br />
    The choice "Use custom settings for history" will stay selected as long as not all settings are the default to make you aware that you made changes.<br />
    * Make sure that you not run Firefox in (permanent) [[Private Browsing]] mode
    * You enter Private Browsing mode if you select: Tools > Options > Privacy > History: Firefox will: "Never Remember History"
    * Uncheck: [ ] "Automatically start Firefox in a private browsing session"
    * Websites remembering you and automatically log you in is stored in a cookie.
    * You need an allow cookie exception (Tools > Options > Privacy > Cookies: Exceptions) to keep that cookie, especially for secure websites and if you let cookies expire when Firefox closes
    * Make sure that you do not use [[Clear Recent History]] to clear the "Cookies" and the "Site Preferences"
    Clearing "Site Preferences" clears all cookies, images, pop-up windows, software installation, and password exceptions.
    See also:
    * http://kb.mozillazine.org/Cookies
    * [[Enabling and disabling cookies]]

  • How to export book pdf using custom presets for all book files in indesign using javascript

    How to export book pdf using custom presets for all book files in indesign using javascript.

    Hi jackkistens,
    Try the below js code.
    Note: you can change your preset name in below (e.g, Your preset name).
    var myBook = app.activeBook;
    myBook.exportFile(ExportFormat.PDF_TYPE, File (myBook.filePath+"/"+myBook.name.replace(/\.indb/g, ".pdf")), false, "Your preset name", myBook.bookContents, "Book_PDF", false);
    example:
    var myBook = app.activeBook;
    myBook.exportFile(ExportFormat.PDF_TYPE, File (myBook.filePath+"/"+myBook.name.replace(/\.indb/g, ".pdf")), false, "[High Quality Print]", myBook.bookContents, "Book_PDF", false);
    thx,
    csm_phil

  • I have selected "Use custom settings for history" and pressed "OK" but it defaults back to "Remember history", how do I stop this?

    I have to enable cookies in order to have an online purchase credited to my mileage account. So, I opened Firefox Tool and selected Options then Privacy. There, I changed "Remember history" to "Use custom settings for history," as, this will achieve what I am trying to do. However, when I press "OK" the box jumps back to the Privacy box and I see that "Remember history" is still the setting. What steps do I take to prevent the Privacy box from defaulting to "Remember history" when I want to change that setting to something else?

    The "Use custom settings for history" selection allows to see the current history and cookie settings, but selecting this doesn't make any changes to history and cookie settings.
    Firefox shows "Use custom settings for history" as an indication that at least one of the history and cookie settings is not the default to make you aware that changes were made.
    If all History settings are default then the custom settings are hidden and you see "Firefox will: (Never) Remember History".
    "Never Remember History" means that Private Browsing is active and "Always use private browsing mode" gets a checkmark.
    Do you have a problem with the cookies?
    You can inspect and manage permissions for the domain in the currently selected tab via these steps:
    *Click the "[[Site Identity Button|Site Identity Button]]" (globe/padlock) on the location/address bar
    *Click "More Information" to open "Tools > Page Info" with the Security tab selected
    *Go to the Permissions tab (Tools > Page Info > Permissions) to check the permissions for the domain in the currently selected tab
    Clear the cache and remove cookies only from websites that cause problems.
    "Clear the Cache":
    *Firefox/Tools > Options > Advanced > Network > Cached Web Content: "Clear Now"
    "Remove Cookies" from sites causing problems:
    *Firefox/Tools > Options > Privacy > "Use custom settings for history" > Cookies: "Show Cookies"

  • My privacy setting is stuck on Remember history, won't stay on Use custom settings for history after I set and click ok

    When I go into Tools, Options, Privacy and set 'Use custom settings for history' and then click okay it will not save. It stays on 'Remember history', though it will save 'Never remember history' as I tested this. This seems to have happened after recent Firefox latest update. Does anyone know why I can't choose 'Use custom settings for history' as this is the setting I want to use?

    It's not that I'm not satisfied with the current settings, it's just that I'm one of those curious people - wanting to know why suddenly I couldn't change my history setting when I could always chop and change it before to a setting of my choice. I noticed this has happened since recently updating to Firefox 6. When things like this just happen I always search for a reason. Anyway, it sounds as though I am a bit of a novice on Firefox compared to yourself, and if you recommend that it's probably best to stay on Remember History and it's not likely to cause any problems, then say no more, I shall accept your advice. Any more tips would be greatly appreciated! Thanks.

  • Can i use Custom Tags for Database retrieval (as per MVC pattern)?

    In our project we are dealing with database, and i've used the Cutom Tags for database retrieval (as per the Article from Mr Faisal Khan) and it is working fine. But i have a doubt if it affects the performance in any way . I wanted to know if its recommendable to use Custom Tags for the DB retrieval as per MVC Pattern or shall i create a intermediate bean and then call the bean in custom tag.
    Thanks
    Prakash

    Putting database code in your JSPs certainly couples your view to the database. That's usually not good.
    If it's a simple app, it might be justified.
    When you start having lots of pages and complex business logic it becomes less attractive. - MOD

  • When I try to set my 'History Setting' to 'Use custom settings for history' it doesn't appply - it continually defults to 'Never Remember History' - how do I fix it?

    When I got into my 'History Setting' and click on 'Use custom settings for history' it doesn't apply. I click on the 'OK' tab and it appears to apply and then closes. When I go back into it, in order to see if it applied, it has reset back to the 'Never Remember History'. How do I fix it?

    If "Never Remember History" is displayed then that means that you are in Private Browsing mode and that all other history settings have the default value.
    *https://support.mozilla.com/kb/Private+Browsing
    If you intend to run Firefox in Private Browsing mode the that is OK.<br />
    Otherwise you need to leave mode.
    To see all History and Cookie settings, choose: Tools > Options > Privacy, choose the setting <b>Firefox will: Use custom settings for history</b>
    * Deselect: [ ] "Permanent Private Browsing mode"

  • I cant turn on the coockies when i go to the tools --- options--- privacy and choose use custom sitting for history and click OK. Then o go back nothing changed

    i cant turn on the coockies when i go to the tools --->options--->privacy and choose use custom sitting for history and click OK. Then o go back nothing changed

    Note that the "Use custom settings for history" selection allows to see the current history and cookie settings, but selecting this doesn't make any changes to history and cookie settings.<br />
    Firefox shows the "Use custom settings for history" selection as an indication that at least one of the history and cookie settings is not the default to make you aware that changes were made.<br />
    If all History settings are default then the custom settings are hidden and you see "Firefox will: (Never) Remember History" (Never remember history means that Private Browsing mode is active).
    "Use custom settings for history" stays selected if at least one of the History or Cookie settings is not the default to make you aware that changes from the defaults are made.
    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance).
    *Do not click the Reset button on the Safe mode start window or otherwise make changes.
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes
    If you do not keep changes after a restart then see:
    *http://kb.mozillazine.org/Preferences_not_saved

  • How to load an applet using custom classloader ?

    Hi All,
    How to load an applet using custom classloader rather than using default browsers classloader i.e AppletClassLoader usually ?
    Regards,
    Kumar.

    I would guess that that would require two applets.
    The first does nothing but create the custom class loader and then load the second applet.

  • Firefox 5.0 Cannot select "use custom settings for history" firefox reverts to "remember history" Why? Cannot access my mail inbox. is this a bug or have I done something wrong

    pc concerned is running XP home has firefox 5.0 I do not know
    what plugins firefox has

    If Firefox shows "Remember History" then that means that all history settings have the default value.<br />
    Only if all History settings are default then you see "Firefox will: (Never) Remember History".<br />
    "Use custom settings for history" reverts to "(Never) Remember history" if all History and Cookies settings have the default setting.<br />
    You see "Use custom settings for history" if at least one of the History or Cookie settings is not the default to make you aware that you made changes.<br />

  • The struggle of creating a Custom ClassLoader for Native libraries

    Hello Everyone,
    I'm having a really hard time writing and using my own ClassLoader in a Java Applet.
    Context :
    As the this link shows - http://codethesis.com/tutorial.php?id=1 - loading and especially unloading native libraries through Java requires defining our own ClassLoader, and use it to instantiate a class loading a library. When the class using native libraries has finished execution, setting all references to the classloader and calling the garbage collector will cause the native library to be unloaded. The class to load within the custom classloader is thus read byte after byte from the jar and defined using the Classloader.defineClass(..) function. So that's what I did. But I've got two problems.
    Problem 1 :
    On one single machine over 15 tested, the magic number of a given class read from the Jar using Applet.class.getResourceAsStream(classname) takes a value different from CAFEBABE and the defineClass function then throws an "Incompatible magic value" exception (see below). The workaround I found is to force the first 4 bytes of the byte array read from the class with CAFEBABE. But I still would like to understand why it takes a different value on this machine.
    Exception in thread "thread applet-MyApplet.class-1" java.lang.ClassFormatError: Incompatible magic value 409165630 in class file Reader
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at NativeClassLoader.findClass(Unknown Source)
    Problem 2 :
    On windows, the NativeClassLoader works perfectly, but on Linux, I'm getting a java.lang.VerifyError (see below).
    Code is compiled with java 1.6.0_06 on windows XP. I tried to remove everything related to native code (remove .so load), the same error is raised.
    java.lang.VerifyError: (class: Reader, method: <clinit> signature: ()V) Illegal instruction found at offset 1
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
    at java.lang.Class.getConstructor0(Class.java:2699)
    at java.lang.Class.newInstance0(Class.java:326)
    at java.lang.Class.newInstance(Class.java:308)
    Code :
    NativeClassReader (custom) :
    public class NativeClassLoader extends ClassLoader {
        //the unique instance of the NativeClassLoader
        private static NativeClassLoader instance;
        private NativeClassLoader () {
            super(NativeClassLoader.class.getClassLoader());
         * Get the Singleton instance of the class
        public static NativeClassLoader getInstance () {
            if (instance == null)
                instance = new NativeClassLoader();
            return instance;
        public static void dispose () {
            instance = null;
         * Load a class using its full java name (prefixed with package)
        public Class findClass (String theName) {
            byte[] b = null;
            try {
                b = loadClassDataFromJar(theName);
                Class clazz = defineClass(theName, b, 0, b.length);
                resolveClass(clazz);
                return clazz;
            } catch (Exception e) {
                return null;
         * Gets the bytes of a class file stored in the current jar using
         * its full class name
        public byte[] loadClassDataFromJar (String theName)
                                     throws Exception {
            String filename = "/" + theName.replace('.', '/') + ".class";
            InputStream is = SawsApplet.class.getResourceAsStream(filename);
            BufferedReader br = new BufferedReader(new InputStreamReader(is));
            //compute file size
            Vector vChars = new Vector();
            int c;
            while ((c = br.read()) != -1)
                vChars.add(new Byte((byte) c));
            //fill in byte array with chars read from the buffer
            byte[] buff = new byte[vChars.size()];
            //workaround for a bug on one (some) Vista machine(s)
            //force magic number to CAFEBABE instead of 18635F3E
            if (vChars.size() > 3) {
                buff[0] = (byte) 0xCA;
                buff[1] = (byte) 0xFE;
                buff[2] = (byte) 0xBA;
                buff[3] = (byte) 0xBE;
            for (int i = 4; i < vChars.size(); ++i)
                buff[i] = ((Byte) vChars.get(i)).byteValue();
            return buff;
    }Reader (loading native libary) :
    public class Reader {
       static {
         System.loadLibrary("myLib");
        public static native String getData();
    }Main :
        NativeClassLoader cLoader = NativeClassLoader.getInstance();
        Class clazz = cLoader.findClass("Reader"); // ClassFormatError thrown here
        Object reader = clazz.newInstance(); // VerifyError thrown here
        Method m = clazz.getMethod("getData");
        String s = m.invoke(reader);
        print(s);
        s = null;
        m = null;
        reader = null;
        clazz = null;
        cLoader = null;
        NativeClassLoader.dispose();
        System.gcAny ideas would be really appreciated :-)
    Guillaume

    Are you using the executable exe file and the filename as a parameter in the custom task?
    Andreas Baumgarten | H&D International Group

  • Using custom ClassLoader

    Is there a way to make my custom ClassLoader the default ClassLoader for my program?
    ie. Can I just set up my program to use my ClassLoader whenever it needs to access class files?
    Geoff.

    Hi,
    The main class is always loaded by the boot strap class loader(also called System ClassLoader). You can't change it. After that all the classes are loaded by the classloader of the loading class. i.e.
    If class A is loading class B, then class B's classloader will be the classloader of class A.
    So, basically you need to write a classloader, and a wrapper class for your main class like:
    public class WrapperClass
        public void main(String[] args) throws Exception
           MyClassLoader myClassLoader = new MyClassLoader();
           Class mainClass = myClassLoader.loadClass("MainClass");
           Method mainMethod = mainClass.getMethod("main", new Class[] {args.getClass()});
           mainMethod.invoke(null, args);
    }then rest of the classes including MainClass are loaded by the MyClassLoader. If you need help you writing ClassLoader please reply back.
    Hope this helps.

  • Use custom field for work phone number in CUCiLync

    Hi,
    I have searched and tried out all sorts of different settings for enabling/changing the way CUCiLync searches the Active Directory (AD) for contact phone numbers.
    But no matter what setting I use in the HKEY_CURRENT_USER\Software\Cisco Systems, inc.\ Client Services Framework\AdminData and/or HKEY_CURRENT_USER\Software\Cisco Systems, inc.\ Client Services Framework\Active Directory hive, CUCiLync still uses the default for Work phone number. The default for this is to use telephoneNumber, the value that I wish to use is the ipPhone field.
    The registry values that I have tested so far are these.
    HKEY_CURRENT_USER\Software\Cisco Systems, inc.\ Client Services Framework\AdminData
    LDAP_AttributeName_businessPhone
    LDAP_AttributeName_primaryPhoneNumberForSearches
    LDAP_AttributeName_otherPhone
    All set to ipPhone, and I have also tested to set it to another field in AD that contains the same value as the ipPhone, that is in my case extensionAttribute5.
    HKEY_CURRENT_USER\Software\Cisco Systems, inc.\ Client Services Framework\Active Directory
    BusinessPhone
    PreferredNumber
    DisableSecondaryNumberLookups
    First two set to ipPhone and the third set to 0, and I have also tested to set it to another field in AD that contains  the same value as the ipPhone, that is in my case extensionAttribute5.
    The above values comes from these two urls,
    http://www.cisco.com/en/US/docs/voice_ip_comm/cucimoc/8_5/english/installguide/config_active_directory.html#wp1141403
    http://www.cisco.com/en/US/docs/voice_ip_comm/cucimoc/8_5/english/installguide/config_active_directory.html#wp1137551
    The later url have this
    Table 3-9 LDAP Registry Subkeys
    Subkey   Names
    Description
    LDAP_AttributeName_primaryPhoneNumberForSearches
    Specify   the phone number that you use to resolve most LDAP queries. This value must   match one of the values specified for the following LDAP keys:
    •LDAP_AttributeName_businessPhone
    •LDAP_AttributeName_homePhone
    •LDAP_AttributeName_mobilePhone
    •LDAP_AttributeName_otherPhone
    The   values that are valid for the LDAP attribute keys listed above are:
    •telephoneNumber
    •homePhone
    •mobilePhone
    •otherTelephone
    •a   custom LDAP attribute value, for example, myCustomPhoneNumber
    The   value of the LDAP_AttributeName_primaryPhoneNumberForSearches key must match   one of the values in the list above, for example, telephoneNumber. Otherwise,   the value of the LDAP_AttributeName_businessPhone key is used.
    The version of CUCiLync is 8.5(3)-4.5.9, that is the latest I can find on the support download page, have also tried with earlier version 8.5.(1).
    Does anyone have any suggestions for how to achieve this, if at all possible?
    Roger Kallberg

    This is the reply we got from TAC.
    Regarding to your query, Can you please go through the attached flow diagram (also you can see it in the link given below). I hope it will clarify more on the telephone number display behavior in office communicator.
    As per this flow chart presently your setup is working as designed. As per the design, the number should be in E.164 format in order to be available in MOC.
    You have AD in your network as a source, so  OCS pulls this information from LDAP it is integrated with. As per Microsoft, here you need to add Normalization rules to OCS to normalize the number into the E164 format.
    http://technet.microsoft.com/en-us/library/bb964002%28office.12%29.aspx
    Phone number display for MOC contact:
    •-          OCS will not provide a contacts number unless it is correctly formatted to the E.164 standard.
    •-          The Address Book Service on OCS processes the contacts phone number and attempts to normalize it.
    •-          If correctly normalized then the number is inserted into the OCS address book.
    •-          Communicator will only display this normalized number if it is properly formatted in E.164 (+13125551234).
    •-          The E.164 standard defines an international numbering plan for public phone systems.
    •-          In the E.164 standard, each number contains a country code, an area code, and a subscriber number.
    •-          Each phone user has a globally unique number.
    •-          In Cisco UC Integration for Microsoft Office Communicator, phone numbers in E.164 format must begin with a plus character ("+").
    I have done some research to your first question. Can you please just go through the blog given below from the Microsoft.
    http://blogs.pointbridge.com/Blogs/schertz_jeff/Pages/Post.aspx?_ID=26.
    It tells that If the numbers not in E.164 format then the number will not appear in office communicator if LDAP integrated. Can you please check with Microsoft to see their inputs on this.

Maybe you are looking for

  • Using cfdocument to generate PDF

    Hi all, The actual table is a lot larger than the mock-up one that I am going to show you but this mock-up one does explain the problem.  Please go to http://www.monteandjanicechan.com/test_table.cfm The thickness of the grid lines in the table are c

  • Touchpad now working (not detected)

    Good day, Since a week (maybe kernel 3.3.2 update, not sure) ago my touchpad stopped working (at all). I have attempted googling many times but could not fix it (neither do I found a bug in arch or anywhere for that). Today (kernel 3.3.3) it got work

  • Cursor behavior in CAD - UCCX

    UCCX version 9.0.2.11001-24 Agent Desktop 9.0.2.1063 We recently upgraded from version 5.0 to the new version.  Since then, agents have complained that when they receive a skill call, the CAD window takes control of the mouse from whatever they were

  • Can't settle an internal order by amount

    My company wants to settle internal orders to a fixed asset by amount instead of equivalence number or %. Can anyone describe in detail how to do this please.  Thanks and regards Walter

  • Anyconnect IOS Radius

    Hallo, i hace a cisco 881 router with a Anyconnect VPN. the web interface works but when i enter a username i'm getting a login failt. looking at the Eventviewer of the NPS i can see that is is using the wrong NETWORK and CONNECT POLICY, it needs to