How to make a Java app compute an MD5sum of itself

I am trying to write an open-source online Java game which will feature, among other things, an online economy system. The problem with this is security: I need a way to verify that the client app accessing the server has not been modified in any way. The client will be available as both an applet and as a standard Java application, making this somewhat more difficult.
My current plan is this: when the client connects to my server, it will download a heavily-obfuscated JAR file (the security module of the program does not need to be open-source), and that JAR file will tell the client to compute an MD5sum of itself, as well as gathering a bunch of other data and heavily encrypting it, and it will send this data back to the server. Unfortunately, I do not know how to accomplish either the loading of the classes in the downloaded JAR or the making the program take an MD5sum of itself. I cannot have the program take an MD5sum of the JAR file on disk, because its name may have been changed, and it would not work for the applet version. Somehow I would have to compute a checksum of the code stored in memory, and send that. Is this even possible? Or is there a better, less convoluted way to accomplish what I'm trying to do?

ejp wrote:
You need to read the [Signed JAR file specification|http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html#Signed%20JAR%20File]. The .class files are digested. The digests are listed in a supplement to the manifest. The manifest is signed with a certificate. All that has to be reproducible at the recipient otherwise the JAR is corrupt. It can only be reproduced if the bytecodes agree with the digests and the signature of the digests agrees with the signature in the manifest, in other words essentially if the JAR is signed. And if it is signed by your certificate, it is your JAR file. Otherwise it is either corrupt or somebody else's JAR file. And only you can sign with your certificate because it is done with your private key, which is, well, private.Now it makes sense, thanks. But there's still one piece missing: how do you tell the server that you're running the signed version of the app? And how does the server know that the client is telling the truth?

Similar Messages

  • How to make a Java program that recognises a function of two variables...

    How to make a Java program that recognises a function of two variables to assign values to that?
    First I will give an example and then do the question.
    Ex1.
    We have any function, eg.y = x ^ 2 + 1 (read 'y' equals 'x' high to the square), a function of the second degree.
    To build the graph of this function attach values to 'x' to find the values of 'y'
    And thus mount the pair ordered (x, y) which represents a point on the Cartesian plane.
    Assigning values to 'x' 'we can build up a table that gives us the pairs ordered:
    We can use any numbers, but arfer interval [-3.3]
    X | y = x ^ 2 + 1
    -3 | Y = (-3) ^ 2 +1 = 10
    -2 | Y = (-2) ^ 2 +1 = 5
    -1 | Y = (-1) ^ 2 +1 = 2
    0 | y = (0) ^ 2 +1 = 1
    1 | y = (1) ^ 2 +1 = 2
    2 | y = (2) ^ 2 +1 = 5
    3 | y = (3) ^ 2 +1 = 10
    We then ordered the pairs:
    (-3.10), (-2.5); (-1.2), (0,1), (1,2), (2,5), (3,10)
    Tabem that can be represented by a table:
    X | y
    -3 | Y = 10
    -2 | Y = 5
    -1 | Y = 2
    0 | y = 1
    1 | y = 2
    2 | y = 5
    3 | y = 10
    Now I begin to explain my doubts.
    See this program:
    Ex2
    * To change this template, choose Tools | Templates
    * And open the template in the editor.
    Encontrando_o_valor_de_y package;
    * @ Author des Soldat Gottes
    Import javax.swing.JOptionPane;
    Public class (Main
    * @ Param args the command line arguments
    Public static void main (String [] args) (
    Int x, y;
    String x1;
    X1 = JOptionPane.showInputDialog ( "We have the function y = x + 1 \ n" +
    "Assign a value for 'x',"); / / receives a value for the function y = x + 1
    X = Integer.parseInt (x1); / / tranforma String in int
    Y = x + 1; / / receives the value of 'x' and calculates' y '
    JOptionPane.showMessageDialog (null, "The value of 'y' is: \ t \ t" + y);
    / / Displays the value of 'y'
    System.exit (0);
    We see that the program receives above a value for 'x' and replaces the function contained in the program, y = x + 1, and so is the value of the variable 'y'.
    In: x1 = JOptionPane.showInputDialog ( "We have the function y = x + 1 \ n" +
    "Assign a value for 'x',");
    The entry is a number and that number is assigned aa ja existing function in the (y = x + 1).
    The question is: would it be possible to come to a function?
    Ex: the program ask: DIGITE THE FUNCTION?
    The USUARIO DIGITARIA A FUNCTION ANY, TYPE: y = x ^ 2 +1
    The program would recognize the function and give numerical values to that function as Ex1, at the beginning of this text.
    And then to find the values of the x and y launch a table.
    It would be possible that?
    By invez of entering with a number so that the program sustitua a function ja existing as Ex2, seen above, entering with a function quaquer (type: y = x ^ 2 +1) for the program atribuisse values to that function and then create a table of values as Ex1.
    I hope it has been easier to understand my doubts now.
    Thank you for your attention!
    God bless!

    rafaelmenezes wrote:
    Thanks for the explanation, could understand what fly said.
    But as it applied to a program?
    How to create a program that recognizes that the entry coefficients?Are you asking about how to parse out the coefficients from the string "3x^4 + 4x^3 - 8x^2 + 5x^1 + 2x^0"? If you define the format to strictly follow that example, this should get you started:
    Strip out the spaces
    Split the String on "x^"
    That should give you [3, 4+4, 3-8, 2+5, 1+2, 0]
    Split each resulting String on "+ | -", preserving the operator as a token so you can apply the correct sign to the coeff.
    That should leave you with [3, 4, +, 4, 3, -, 8, 2, +, 5, 1, +, 2, 0]. Every other number is a coeff, the rest are the degrees.
    You can strip out the +, since those coeffs are already positive, and strip out the - after negating the following number. This is all assuming that you have to write this yourself. There is no doubt already a library or 5 out there that does this for you.

  • How to make a java program, that can be used by c++ application

    I'm developing a Java web application (WEBapp), but I have also a c++ program.
    C++ program must use WEBapp method to communicate on the web.
    How to make a Java public function that accept value, elaborate, then return the resul to c++ application?

    jschell wrote:
    You have C code.
    You have Java code.
    The two must communicate.I have a c++ program, and a Java program.
    C++ program wants to communicate on the web (send text), and I'm trying to add this functionality to it creating a Java program.
    NOW THE PROBLEM? How c++ program can use java-program (in local) to send data on the web?
    You can just JNI to communicate either from java to C++ or from C++ to java. That is direct communication in that there is a single process involved. Thus you will no longer have a java application and a C++ application but rather a single application.I don't know JNI, i found http://java.sun.com/docs/books/jni/ and I think is too difficult to implement?
    You can use files or sockets to communicate. Using sockets allows for any number of additional protocols including the previously mentioned web services. Those methodologies would allow more than one application to exist.I developed yesterday a java-side-interface using socket (in local host 127.0.0.1). So the c++ program must write or read to/from the socket to comunicate to java (then the java program send data on the web).
    Finally it might be the case that you have a C++ application which you cannot modify. In that case then you MUST use whatever input/output mechanism that it supports. There is no choice. And until you have fully determined what those mechanisms are it is pointless to discuss a solution.I can modify the application, but I don't have developed it. The c++ application use a third-part dll (taken from SKYPE) to comunicate on the web: I have to remove the dipendence from this dll, and add the java program: java program must substitute the dll. It must be non-invasive to the c++ program. DLL calls can be "send(data)" or "receive(data)" or similar.
    For this do you think that JNI is a must, or I can use soket on local host?

  • How to make a Java application that will change the client box's IP address

    HI how to make a Java application( that application would be run on the client ) that will change the client box's IP address ( IP address of itself )

    If you can do that through the command line, then use Runtime.getRuntime().exec(...) to execute your command.

  • How to make my java bean internationalization?

    hi,
    I have a project on tomcat. I have rewrite my jsp to multi-language according to user's browse language setting. User's language is English, the jsp shows them English. User's language is Chinese, the jsp shows them Chinese, and so on. But in my java bean code, some exception are thrown out with some message or alert. Can anybody tell me how to make these java beans show the language string acording to user's browse language setting?
    thx
    Pierre

    Dear one_dane,
    Thank you. That is a great document to me. The fact is that my owner code throws exception with a string. The code is:
    if(amount<0) throw new Exception("Please input correct amount.");
    If the code is in jsp, I can convert it to a internationalized String using struts tag <bean:message...>. But it is in a deep function of java class. So must I add a Locale object parameter to the function and all calling functions?
    thx
    yours,
    Pierre

  • How to make an apple app

    How to make an apple app?
    Plz respond

    To become a developer, (that's what Apple calls people who create apps) you must have a Mac. Once you have one, download Xcode. That's the program Apple uses to create apps. (You must know how to code!) Create a developers account (create a different Apple ID for this because if you don't, every thing gets confusing) and buy the developers kit. That's it!

  • HT203254 how to make whats on my computer show on my t.v.

    how to make whats on my computer show on my t.v.

    I'm presuming that you've already made the connection with a suitable cable.  What are you getting on the TV?  Are you getting a completely blank screen?  Are you getting a message similar to 'no input detected'? Or are you getting the spiral galaxy desktop?
    If the last of these then what you have is an extended desktop.  If you move the mouse cursor off the edge of the MBP's screen you will see it appear on the TV.  Similarly you can drag windows from the MBP's screen to the TV.  At present the MBP's screen is the primary display and shows the menu bar and dock, and the TV is the secondary display.  To change this go into System Preferences -> Displays -> Arrangement.  You will see an image of two screens, a smaller one representing the MBP's display and a larger one representing the external display.  At the top of the smaller screen in the image is a bar, this represents the menu bar at the top of the screen.  Drag it from the smaller screen to the larger screen.  The external display will become the primary display and the menu bar and dock will appear there and any new windows or applications that you open subsequently will appear there too.
    silvergc's suggestion to use mirroring will work, but you won't be using the native resolution of the TV which could result in fuzziness or bluriness of the image on the TV.

  • How can i make my java app auto reconnect to Oracle.

    Scenario:
    when i am working with my java app if suddenly Oracle server connection unplugged. Then i got some problems regarding database.
    When they replugged the connection, i need to restart my app again. Then it works fine.
    Question:
    When the database is replugged or restarted, then how can i reconnect to the DB automatically with out restart my app. Please letme know is there any auto reconnect process is there for Oracle.

    If you want your application to reconnect, you would need to add logic that catches the exception that gets thrown when the connection is lost and tries to reconnect.
    Justin

  • How to make The Java Screen Recorder similar to this one?

    Can u talk about this how can make this code with java?
    http://www.devharbor.com/java/300-Screen-Recorder.html
    The author of this application says this maked by Java Swing.
    My Question is:
    What is Java Swing?
    It's easy to make this app?
    What API/Component needed for export video to MP4 Format like this application?
    How can make a similar application for education purpose with Java.
    Thanks

    808154 wrote:
    :) Thank you for answering my question,
    but impossible in nothing bro, Yea, that's what Aleksey Vayner claimed and he didn't do so well.
    I need to know about swing and start to work with java to develop this software and if I need some help I ask here.Clearly yes. You also need to make simple programs and practice for a long time before you're gonna be able to write a screen recorder with MP4 output.
    I try to develop this before 3-4 years ;)I guess 3-4 years is a realistic goal, if you really concentrate on learning Java.

  • How to make a java program run as a background process.

    </pre>
    writing a client server application.
    a program is supposed to run on a the client right from the time the client turns on the computer till the computer is turned off.
    the catch is the client should all the time be unaware of the program running in his computer, no dos prompt window, no icon on the taskbar,etc. can i convert it the class file into an exe file through software and put the exe filename in autoexec.bat. But then i think that the dosprompt window will open up on starting, but the client should see nothing.
    please help
    </pre>

    </pre>
    Thanks Daniel and jesper,
    could not really fully understand what you mean.
    creating a batch file is okay, but do you configure it
    to run in a an hidden mode.
    Also I have no idea of how to make a window
    service.can you please elaborate a bit
    </pre>

  • How to make iPad 2 apps

    I have an amazing idea for an app but I don't know how to make one. Can you help me

    This is probably a good starting place : http://developer.apple.com/ipad/sdk/
    You should probably also register/use the developer forums : https://devforums.apple.com/index.jspa

  • How to make a java portlet using workshop?

    I installed weblogic 8.1 portal and the jsr168 support package.
    Can I make a java portlet (not jsp/html) using workshop? How?
    If I can, to make a new portlet should I drag a class file or java file to portal
    Thanks,
    Jason

    In workshop do:
    F1 (for help)
    Take a look at
    => Tutorials => Portal tutorial
    Geoffrey
    "Jason" <[email protected]> schreef in bericht
    news:3f9700f0$[email protected]..
    >
    I installed weblogic 8.1 portal and the jsr168 support package.
    Can I make a java portlet (not jsp/html) using workshop? How?
    If I can, to make a new portlet should I drag a class file or java file toportal
    Thanks,
    Jason

  • PLZ HELP ME! -- How to make a developer app. Client / Server?

    Can anyone tell me how to make a developer application (which i have build) Client/Server?
    I would like to make a installation cd which i can run? Which program can i use for this and how does this work.
    Thanks,
    Vincent

    Assuming that it is a Forms 6i application, it is in client/server mode already. The fmx files will be installed in the client machine. The application will connect to a databse located on another machine (server) through Oracle client software (SQL*Net) which will also be installed/configured on the client.
    Regards,
    Rajesh

  • How to make/create an App

    Is it hard to make an iPad App? And if the App is finish were will i submit the App?

    Good morning Fanboy
    I'm sure it's straight-forward.  The difficulty is usually the compelling idea that others will want to use it.
    Lots of material if you your Google your question.
    Here is a good link.
    Hope it helps and let us know when it's ready!
    http://developer.apple.com/library/ios/#documentation/ToolsLanguages/Conceptual/ YourFirstAppStoreSubmission/AboutYourFirstAppStoreSubmission/AboutYourFirstAppSt oreSubmission.html

  • How to ensure a Java App writes well-formed XML

    I have created an event logger utility which creates an XML log of an application's activity. At the moment, it manually writes the XML as text strings, with manual encoding of &, <, > symbols.
    Occasionally the text written to the XML is not considered well-formed in Internet Explorer because it contains characters with accents.
    Is there any way using SAX or DOM that I could build and write to the log file in real time, and ensure that it is well-formed?
    Thanks in advance for your time...

    The short answer is yes, if you use a package that supports SAX or DOM, it should produce well-formed XML, provided you can figure out how to make it write an XML file.
    The long answer, however, is that once you have written an XML file, you can't just tack data onto the end of it, because doing so makes it malformed. The new data has to be tacked on inside the root element, and that means you have to read the XML into a DOM, append the new data as the last child element, and write the XML out again. Perhaps you could keep your log in a DOM in memory, adding log elements as required, and periodically write it to an XML file. This wouldn't work for a large volume of logs, because it would expand to fill your memory, but it would be okay for a small volume.

Maybe you are looking for

  • Moving Catalogs from XP Pro to Win 7 on a new pc

    Here's what I wish to do. [ I apologize for all of the detail that follows, but I am trying to be careful with this.] I want to move my PSE 8 catalog, and all of my pictures,  from my old to my new pc.  The old pc has XP Pro, the new one uses Windows

  • Lightroom vs photoshop cs6

    Hi all I am about to upgrade to CS6 (from CS3), and I see LR has come down in price. I don't currentlty have it, so my question is - is there any point/advantage/functionality in it worth having & paying for that you don't get in CS6/ACR ? thx MJ

  • Migration of multicolumn listbox from 7.1.1 to 8.5

    I recently migrated a VI containing a multicolumn listbox from LV 7.1.1 to LV 8.5. Interestingly the 3D-headers got lost and the hight of the rowes changed. Left in the picture is the LV 7.1.1 version and right is the LV 8.5 version. The font is set

  • Sample Data Scrambling Scripts

    Hi, I am looking for a generalised data scrambling script with algorithm for scrambling columns having amount, SSN, text, telephone number, address etc. Thanks AT

  • Queued Request Limit (Stateless) -

    I have stateless webservice calls setup and I am trying to trigger the Queued Request Limit (Stateless) limitation which is supported to be 5. However it seems that no matter how many concurrent sessions I kick off the calls simply queue up and do no