Disabling the keys with my Java Program

I have a program that extends a JWindow. I would like to make this program my destop, as in disabling all function keys on the keyboard including ctrl+alt+del and others like that.
Some Internet cafe shops use this technique to restrict unauthorised customers from accessing their PCs.
If anyone knows how, please help.
Thanks in advance.

Keys that are listened to by the Window Environment cannot be intercepted with Java alone. This include Ctrl-Alt-Del, as well as Alt-Tab for MS Windows. You would need JNI to do this.
If you use Linux, you could do it in pure Java, with one exception. Ctrl-Alt-Del would terminate X, and bring you to a console login. You may be able to disable that somewhere in the X configuration. This would prevent anyone from getting access to the system, unless they have the login for it. To do this you would need to setup X so it starts without the Gnome/KDE Desktop Manager, and runs your full screen Java app instead.

Similar Messages

  • Sending the key with Socket

    Hello!
    I have made an application that encrypts a byte[], sends it to a server.
    And after that i am trying to decrypt it. But that gives me problem.
    The exception i get is:
    BadPaddingException: javax.crypto.BadPaddingException: Given final block not properly padded.
    This is my code.
    The client
    import java.net.*;
    import java.io.*;
    import javax.crypto.*;
    import javax.crypto.spec.*;
    import java.security.*;
    import java.security.spec.*;
    import java.util.*;
    class Client
      public static void main(String a[])
        Socket socket = null;
        try
          // Create Key
          KeyGenerator kg = KeyGenerator.getInstance("DES");
          SecretKey secretKey = kg.generateKey();
          // Create Cipher
          Cipher desCipher = Cipher.getInstance("DES/ECB/PKCS5Padding");
          desCipher.init(Cipher.ENCRYPT_MODE, secretKey);
          socket = new Socket("localhost", 3000);
          DataOutputStream dataOutputStream = new DataOutputStream(socket.getOutputStream());
          ObjectOutputStream out = new ObjectOutputStream(socket.getOutputStream());
          File file = new File("Mattias.jpg");
          FileInputStream fileInputStream = new FileInputStream(file);
          byte[] bytes = new byte[(int)file.length()];
          fileInputStream.read(bytes);
          fileInputStream.close();
          byte[] encryptedBytes = new byte[(int)file.length()];
          encryptedBytes = desCipher.doFinal(bytes);
          out.writeInt((int)file.length());
          out.writeObject((Object)secretKey);
          dataOutputStream.write(encryptedBytes);
          out.flush();
          dataOutputStream.flush();
          out.close();
          dataOutputStream.close();
        catch(IOException e)
          e.printStackTrace();
        catch (NoSuchPaddingException e)
          System.err.println("Padding problem: " + e);
        catch (NoSuchAlgorithmException e)
          System.err.println("Invalid algorithm: " + e);
        catch (InvalidKeyException e)
          System.err.println("Invalid key: " + e);
        catch (IllegalBlockSizeException e)
          System.err.println("IllegalBlockSizeException: " + e);
        catch (BadPaddingException e)
          System.err.println("BadPaddingException: " + e);
        finally
          try
            socket.close();
          catch(IOException e)
            e.printStackTrace();   
    The server
    import java.net.*;
    import java.io.*;
    import javax.crypto.*;
    import javax.crypto.spec.*;
    import java.security.*;
    import java.security.spec.*;
    import java.util.*;
    class Server
      public static void main(String a[]) throws IOException
        new Server().listen(3000);
      public void listen(int port) throws IOException
        ServerSocket serverSocket = new ServerSocket(port);
        new SocketHandler(serverSocket.accept()).start();
      class SocketHandler extends Thread
        Socket socket = null;
        SocketHandler(Socket socket)
          this.socket = socket;
        public void run()
          try
            SecretKey secretKey = null;
            File file = new File("file.jpg");
            OutputStream fileOutputStream = new FileOutputStream(file);
            BufferedInputStream bufferedInputStream = new BufferedInputStream(socket.getInputStream());
            ObjectInputStream in = new ObjectInputStream(socket.getInputStream());
            int fileSize = in.readInt();
            byte[] encryptedBytes = new byte[fileSize * 8];
            byte[] bytes = new byte[fileSize];
            secretKey = (SecretKey)in.readObject();
            // Create Cipher
            Cipher desCipher = Cipher.getInstance("DES/ECB/PKCS5Padding");
            desCipher.init(Cipher.DECRYPT_MODE, secretKey);
            int i = -1;
            while (true)
              i = bufferedInputStream.read(encryptedBytes, 0, encryptedBytes.length);
              bytes = desCipher.doFinal(encryptedBytes);
              if (i == -1)
                break;
              fileOutputStream.write(bytes, 0, i);
            bufferedInputStream.close();
            fileOutputStream.flush();
            fileOutputStream.close();
          catch (IOException ioe)
            ioe.printStackTrace();
            catch(ClassNotFoundException cnfe)
            cnfe.printStackTrace();
          catch (NoSuchPaddingException e)
            System.err.println("Padding problem: " + e);
          catch (NoSuchAlgorithmException e)
            System.err.println("Invalid algorithm: " + e);
          catch (InvalidKeyException e)
            System.err.println("Invalid key: " + e);
          catch (IllegalBlockSizeException e)
            System.err.println("IllegalBlockSizeException: " + e);
          catch (BadPaddingException e)
            System.err.println("BadPaddingException: " + e);
          finally
            try
              socket.close();
            catch (IOException ioe)
              ioe.printStackTrace();
    }What am i doing wrong? How should i solve it?

    This looks suspect -DataOutputStream dataOutputStream = new DataOutputStream(socket.getOutputStream());
          ObjectOutputStream out = new ObjectOutputStream(socket.getOutputStream());It is normally a bad idea to attach a single OutputStream to 2 or more 'filter' streams.
    You could always sent the data as an object i.e.out.writeObject(encryptedBytes);Also, you make the assumption that the encrypted length is the same as the file length. With PKCS5Padding this is never the case since it pads with 1 to 8 bytes to make up to the block size. This is probably the cause of the BadPaddingException. If you send the encrpted data over as an object then you don't need to send the length.
    Your stream uses in the client and server differ. You have no DataInputStream in the server to match the DataOuputStream in the client. To be safe, stick to Object streams or Data streams but don't mix.
    P.S. Isn't sending the key with the cipher text a litte insecure!!!

  • How to translate the key words in ABAp program from lower case to upper cas

    How to translate the key words in ABAp program from lower case to upper case?

    Hi Kittu,
    You need to set the Pretty Printer settings to achieve key words in ABAP program from lower case to upper case.
    Utilities -> Settings -> Pretty Printer (tab) -> Select third radio button.
    Thats all.
    <b>Reward points if this helps.
    Manish</b>

  • Why doesn't the rotate gesture on my trackpad behave as it used to for switching between tabs when it works the same with all other programs besides Firefox?

    Why doesn't the rotate gesture on my trackpad behave as it used to for switching between tabs when it works the same with all other programs besides Firefox?
    I changed the about:config to make the rotate gesture move between tabs, and it worked great for well over a year. Now it behaves erratically as described here:
    https://bugzilla.mozilla.org/show_bug.cgi?id=877598
    It used to be very controllable to move one tab over, now it is erratic and moves quickly and to unexpected tabs regardless of how slow I do the rotate gesture. This is the main reason I use Firefox over Chrome and I would like to continue to do so unless there is no fix to this.

    Just set the browser.gesture.twist.threshold to something around 15-25.

  • How can I disable the advancedAntiAliasing with fontswf in sdk

    Hi,
    in asc2.0 we need 'fontswf' script to embed fonts instead of use .as file directly.
    but here is a problem
    I cannt disable the advancedAntiAliasing with fontswf ?
    because I have found an issue when I set advancedAntiAliasing is true, then the textfield (which font is embeded) antiAliasType doesn't work even type is advanced. I need set advancedAntiAliasing is false (in asc1.0 you can set it by .as file)
    now i just set the sharpness and thickness to workaround in used asc2.0
    but i think that is not great.
    so how can I disable the advancedAntiAliasing with fontswf  or any other solution?
    thanks
    hbb

    Hello -
    That setting is not fully supported.  You can explicitly call it like this:
    ./compc -include-sources  ../samples/test/Main.as -output ../samples/test/Main.swf -advanced-anti-aliasing=true/false
    So, that is the compiler option that you want to use in order to disable it.  The example I show you here uses the command line tool but it is a valid switch via Flash Builder as well

  • What is the  best money making java program?

    what is the best money making java program?
    any of them are in fact very "simple"? - say in fact can be develop by a middle- level programmer.

    public class MoneyMaker {
       public static void main(String[] args) {
          while (true) {
             System.out.println("+-----------------------------------------------+");
             System.out.println("| 10        RESERVE BANK OF INDIA \"93T 872468\"  |");
             System.out.println("|                                               |");
             System.out.println("|   ______                                   10 |");
             System.out.println("|  /      \\             __          ____        |");
             System.out.println("|  |      |        /|  /  \\        /  __\\       |");
             System.out.println("|  |      |         | |    |       0_o  \\\\      |");
             System.out.println("|  |      |         | |    |      /      ||     |");
             System.out.println("|  |      |         |  \\  /       `==    ||     |");
             System.out.println("|  |      |        ===  **         \\    /       |");
             System.out.println("|  |      |                        /\\--/        |");
             System.out.println("|  \\______/                       /______   /\\  |");
             System.out.println("|                                           \\/  |");
             System.out.println("| \"93T 872468\"                                  |");
             System.out.println("+-----------------------------------------------+");
             System.out.println("");
    }

  • Bex Hierarchy showing just the key with Attributes ????

    Hierarchy showing just the key with Attributes ????  I want the Text without attribute!
    I had created a Hierarchy manually on 0companycode characteristic, but I have some problems.
    1 u2013 Itu2019s showing just the KEY (On query Design is marked to show the text , and Iu2019m on the proper language).
    2 u2013 On the last lever that is the company code, is showing the key with all attributes like this.
    ->     CONTRY_BR
                    -> KW11 Contry Canada Chart of account 0001 Currency 01
    I want just the Text without the attributes.
    Regards
    Edited by: Marcus Coufal on Mar 4, 2011 1:53 PM

    On the caracteristic -> attribute put 0 on  "Order For"

  • Problem with a java program "the game five in a row"

    http://leepoint.net/notes-java/examples/games/five/five.html
    how to run this program and c the output

    i.arnav wrote:
    no i want it in java programming only
    plz help me how to run it if thr are any errorsI'm having a difficult time understanding your posts. THR? The Hollywood Reporter? Total Hip Replacement?The High Road (firearms forum)?

  • How can I get the events from a java program?

    I want to make a monitor to watch a java program.How can I get the events from the GUI of this program some as mouse cliking, keyinput. So I can watch these in my monitor.
    Thanks

    Hi,
    To put a monitor to the events occuring in the GHUI u need to register required components with the appropriate EventListeners.
    Liek if u want to get notified when a mouse is clicked, then u need to add The MouseListener to the component which u want to be monitored.
    Say
    myFrame which is the JFrame object which shuld be monitored for the events.
    Then in ur program u have to add following code
    myFrame.addMouseListener( someObectReference );
    Here the someObjectReference should be an instance to a concrete class ..i.e. U write a class like the following
    public class MyMouseListener implements MouseListener {
    // override the followig methods
    public void mouseClicked(MouseEvent me){ sop("MOUSE CLICKED ON THE FRAME");}
    public void mousePressed(MouseEvent me){}
    public void mouseReleased(MouseEvent me){}
    If u dont want to use another class for listening to the events. Then u can make teh current class monitor the events. To do so ur class should implement the appropriate listener and should override the required methods.
    and u should say myFrame.addMouseListenet( this );
    thats it

  • How to edit the existing data in the XML file from java programming.

    Hi all
    i am able to create XML file with the sample data as below from java programming.
    i need sample code on how to edit the existing data in the XML file?
    for example
    <?xml version="1.0"?>
       <mydata>
               <data1>
                         <key1>467</key1>
                        <name1>Paul</name1>
                        <id1>123</id1>
              </data1>
              <data2>
                         <key2>467</key2>
                        <name2>Paul</name2>
                        <id2>123</id2>
              </data2>
        </mydata>
    i am able to insert the data in the XML.
    now i need sample code on how to modify the data in the above XML file from the java programming for only key2,name2,id2 tags only. the remaining tags data in the XML file i want to keep same data except for key2,name2,id2 which are i want to modify from java code
    Regards
    Sunil
    [points will be always rewardable]

    hi
    u need a parser or validate the xml file for to read the xml file from java coding u need for this
    xml4j.jar u can download this file  from here
    http://www.alphaworks.ibm.com/tech/xml4j
    or we can use the SAX(simple API for XML)
    some sample applications for this
    http://www.java-tips.org/java-se-tips/javax.xml.parsers/how-to-read-xml-file-in-java.html
    http://www.developertutorials.com/tutorials/java/read-xml-file-in-java-050611/page1.html
    http://www.xml-training-guide.com/e-xml44.html
    let me know u need any other info
    bvr

  • Need Help with a JAVA programming assignment

    How do I write a JAVA program that could be used as the start of an MS-DOS/Windows simulation of the IEEE 802.3 protocol? I am to only code the parts necessary to build the 802.3 frame. For the initial implementation, the Checksum function need not be a CRC function, and the Destination and Source addresses wil be in input, stored, and output, and in dotted-decimal format.
    I need:
    1. A record to describe the frame, with each field being a (byte-) string of the required size, except that the Data field is of variable size. Although the "Source address" and "Destination address" would be 6 bytes for a real implementation, for this first implementation you can either assume they'll be text strings in the usual "dotted decimal" form (e.g. "14.04.05.18.01.25" as a typical example--from Tanenbaum, p. 429), or 6 hex digits.
    2. Suitable constant declarations for values such as the standard "Preamble" and "Start of Frame" values.
    3. Suitable functions to Get the three variable values "Destination address", "Source address", and "Data" from the standard input device.
    4. A suitable function to display each of the fields of a given frame in a format such as:
    Preamble: ...
    StartofFrame: ...
    Destination: ...
    etc.
    5. A suitable function to generate a "Pad" field if necessary.
    6. A "dummy" Checksum-generating function which just takes the first 32 bits (4 bytes) of the Data (or Data+Pad, if necessary) rather than an actual CRC algorithm.
    I have no experience with Java. Can you help me or start me in the right direction?
    Thanks...........TK

    If you have no experience with Java, then it seems to me your first step should be to start learning the language. But it's difficult to advise how, since we don't know anything about your background. There are many good books available on Java, some are for beginners and some are for advanced programmers, so I'd suggest you go somewhere that has a large selection and start looking for something that doesn't seem completely over your head.

  • How to download the cap file to the smartcard with my own program

    good morning | afternoon | evening my friends,
    I can download applet with JCop now, but I have to do it with my program,can someone tell me how to do it,especially the steps.
    Allen,

    In case you are using JCOP tools plug-in in Eclipse, choose: Help -> Help Contents->JCOP tools user guide -> Reference -> Offcard API's. There you will find all the java API's necessary for wrtiting java program, that enables to upload, install applet, get info about the card and work with your proper applet installed.
    If you look through the older post, you'll also find several samples of off-card java terminal program code.
    P.S. Another choice would be java 6 smart card I/O.
    Some of us still trying to use OCF technologies. But i advice you not to use it, because this technology is dead.
    Best regards,
    Eve

  • Problem with running java program

    Hey again!
    I missed out some information in last posting.. here is the full description
    I have just installed 1.5.0_06 and have set paths and what otherwise is necessary to run the java programs. I was testing the install and run a standard HelloWorld.java program
    I got the following error:
    Exception in thread main java.lang.NoClassDefFoundError: HelloWorld
    what is wrong...
    Here is the entire HelloWorld.java
    public class HelloWorld
    public HelloWorld()
    System.out.println("Hello World");
    public static void main(String[] args)
    HelloWorld hw = new HelloWorld();
    I have checked that the path is correct too..
    Hopefully someone can help me!
    Anders

    Your Path is set, probably the problem is classpath.
    Change the cmd/command prompt to the directory that contains your HelloWorld.class file, verifying that it exists. If it does, issue this command from that directory:
    java -cp . HelloWorld
    Important: include the period and surrounding spaces
    If that works, you can learn about setting and using the classpath here:
    http://java.sun.com/j2se/1.5.0/docs/tooldocs/index.html#general
    By the way, just add a reply to your original post with the additional information, rather than creating another post. That eliminates duplication of replies.

  • Help with Simple JAVA program

    I'm a complete novice with Java. I want to write a Java program to run on Windows 2000 servers to write a list of certain files in a directory into a *.txt file. I hope to add complexity once I have this basic part working. Here's the code I have so far:
    //this Java application finds poll* files
    public class FindPollApp
    //Create File Object
    File dir = new File("d:/jda/windss/poll");
    //List directory
    if(dir.isDirectory())
    String[] dirContents = dir.list();
    for (int i=0; i < dirContents.length; i++)
    System.out.println(dirContents);
    //Iterate through files
    I get the following errors:
    C:\JAVA>javac FindPollApp.java
    FindPollApp.java:9: illegal start of type
    if(dir.isDirectory())
    ^
    FindPollApp.java:18: <identifier> expected
    ^
    2 errors
    Thanks.

    I'm a complete novice with Java. I want to write a
    Java program to run on Windows 2000 servers to write
    a list of certain files in a directory into a *.txt
    file. I hope to add complexity once I have this
    basic part working. Here's the code I have so far:
    //this Java application finds poll* files
    public class FindPollApp
    //Create File Object
    File dir = new File("d:/jda/windss/poll");
    //List directory
    if(dir.isDirectory())
    String[] dirContents = dir.list();
    for (int i=0; i < dirContents.length; i++)
    System.out.println(dirContents);
    //Iterate through files
    I get the following errors:
    C:\JAVA>javac FindPollApp.java
    FindPollApp.java:9: illegal start of type
    if(dir.isDirectory())
    ^
    FindPollApp.java:18: <identifier> expected
    ^
    2 errors
    Thanks.
    You need to create a method and insert your if statement in there

  • How can we disable the log for Positive Pay program?

    Hi,
    We would like to disable the log file for positive pay program (Positive Pay File with Additional Parameters) because the log contains the whole positive pay file including confidential financial data. Is there any way to disable this logging?

    I do not think there is an option to disable it. However, you may log a SR and confirm this with Oracle support.
    Thanks,
    Hussein

Maybe you are looking for

  • Please confirm wheather the tables changed or obsoleted from 11i to R12.

    All, Can you please let me know whether the following tables are replaced/obsoleted and such information from 11i to R12 as part of upgrade.Please let me know if you need any further information. Just want to know ,the following tables are changed fr

  • 2 GB Ram From Walmart

    I'm looking into installing more ram into my macbook and found this ram at walmart for a heck of a lot cheaper! The only questions I have is, is this ram any good and will it actually work in a macbook? http://www.walmart.com/catalog/product.do?produ

  • Oracle 10g tools for performance/troubleshooting

    Hi I want to find some tools for moniting the performance and troublesooting. Any suggest? OEM tuning pack, statspack...etc Thanks

  • Credit card number changed in my account

    I changed my credit card number in my account and now I can't buy anything, they ask me to take contact with iTunes for changed it and I don't know how do that..

  • DW CS3 Upgrade

    I've been using DW MX since it came out as part of the Macromedia MX Studio but am finally thinking about upgrading at last. I was just about to go and buy the DW CS3 upgrade version when an assoc of mine said that the fact that it was part of an old