How to Hide when input password ?

How to Hide input char when input password
     if (passwd.trim().equals("")) {
          System.out.print("What is your password: ");
          try     { while     (System.in.available() == 0) {
          passwd = new BufferedReader(new     InputStreamReader(System.in)).readLine();
          catch (IOException e) {passwd =     "<"     + e     + ">";}

Hi,
I've taken this from a article by Qusay H. Mahmoud .
This can help you.
-----File: PasswordApp.java-------
import java.io.*;
* @author Qusay H. Mahmoud
public class PasswordApp {
   public static void main(String argv[]) {
      PasswordField passfield = new PasswordField();
      String password = null;
      try {
         password = passfield.getPassword("Enter your password: ");
      } catch(IOException ioe) {
         ioe.printStackTrace();
      System.out.println("The password entered is: "+password);
}-----File: PasswordField.java-------
import java.io.*;
* @author Qusay H. Mahmoud
* This class attempts to erase characters echoed to the console.
class MaskingThread extends Thread {
   private boolean stop = false;
   private int index;
   private String prompt;
   *@param prompt The prompt displayed to the user
   public MaskingThread(String prompt) {
      this.prompt = prompt;
   * Begin masking until asked to stop.
   public void run() {
      while(!stop) {
         try {
            // attempt masking at this rate
            this.sleep(1);
         }catch (InterruptedException iex) {
            iex.printStackTrace();
         if (!stop) {
            System.out.print("\r" + prompt + " \r" + prompt);
         System.out.flush();
   * Instruct the thread to stop masking.
   public void stopMasking() {
      this.stop = true;
* This class prompts the user for a password and attempts to mask input with ""
public class PasswordField {
   *@param prompt The prompt to display to the user.
   *@return The password as entered by the user.
   String getPassword(String prompt) throws IOException {
      // password holder
      String password = "";
      MaskingThread maskingthread = new MaskingThread(prompt);
      Thread thread = new Thread(maskingthread);
      thread.start();
      // block until enter is pressed
      while (true) {
         char c = (char)System.in.read();
         // assume enter pressed, stop masking
         maskingthread.stopMasking();
         if (c == '\r') {
            c = (char)System.in.read();
            if (c == '\n') {
               break;
            } else {
               continue;
         } else if (c == '\n') {
            break;
         } else {
            // store the password
            password += c;
      return password;
}-Manish.

Similar Messages

  • How to conect when network password has been changed

    how to conect when network password has been changed

    Select the network under Settings > General > WiFi and tap Forget This Network. Select the network again and enter the new password when prompted.

  • HT204088 My 3 year has purchased several apps. And I would love to know how she did when my password has to be typed in to confirm purchases...

    My 3 year old has purchased several apps. And I would love to know how she did this when my password has to be typed in to confirm purchases...

    OK
    Sounds like a question for your three year old.

  • How to Hide username and password in command line using maxl

    Hi,
    How to encript my user name and password in command line prompt when I am login to Essbase server using batch file:
    *1_Here is my batch file:*
    Name of the bat file AV_Assig_Var1.bat
    rem This batch file defines the following variables:
    set $1 = 'admin';
    set $2 = 'password';
    essmsh AV_Asig1.mxl admin password
    ===========================
    *2_Here is my maxl file:*
    Name of the bat file AV_Asig1.mxl
    /* Create a process log */
    spool on to 'D:\lova\spool_log.txt';
    /* login (using variables from a batch file */
    login $1 $2 on 10.42.100.229;
    /* create application and database */
    create application AV_Asig1;
    create database AV_Asig1.AV_DB;
    /* End process log */
    spool off;
    exit;
    *3_Command line prompt*
    D:\Ess>AV_Assig_Var1.bat
    D:\Ess>rem This batch file defines the following variables:
    D:\Ess>rem 1: username
    D:\Ess>rem 2: password
    D:\Ess>essmsh AV_Asig1.mxl admin password
    Essbase MaxL Shell - Release 9.3.1 (ESB9.3.1.0.0A181)
    Copyright (c) 2000, 2007, Oracle and/or its affiliates.
    All rights reserved.
    MAXL> login admin password on *10.46.100.222*; /* I want to hide this information */
    OK/INFO - 1051034 - Logging in user [admin].
    OK/INFO - 1051035 - Last login on Monday, June 14, 2010 12:44:03 PM.
    OK/INFO - 1241001 - Logged in to Essbase.
    MAXL> create application AV_Asig1;
    OK/INFO - 1051061 - Application AV_Asig1 loaded - connection established.
    OK/INFO - 1054027 - Application [AV_Asig1] started with process id [6792].
    OK/INFO - 1056010 - Application AV_Asig1 created.
    MAXL> create database AV_Asig1.AV_DB;
    OK/INFO - 1054014 - Database AV_DB loaded.
    OK/INFO - 1056020 - Database AV_Asig1.AV_DB created.
    MaxL Shell completed
    D:\Ess>
    I am looking forward to inputs from anybody.
    Thanks & Regards,
    Deepthi.

    Beyond that thread, I gave a presentation at Kaleidoscope last year around MaxL that goes into quite a bit of depth re encryption and a whole bunch of other MaxL goodies.
    To download it, go to www.odtug.com, click on Tech Resources, Essbase/Hyperion, and use the search box for MaxL.
    There are two presentations, one by Tracy McMullen and the other by me. Tracy's is a good introduction to the various command groups; my presentation focused on a few areas in depth, one of which was encryption. The title is "Master Essbase with MaxL Automation".
    You will need to join ODTUG to download the presentation, but there is a junior membership that is free.
    Regards,
    Cameron Lackpour
    P.S. ODTUG Kaleidoscope 2010 is coming up in two weeks, starting on 27 June 2010 -- for those of you still on the fence, it is an awesome conference and I urge you all to come. The content this year will be fantastic.

  • How to Hide userid and password in the address bar

    Hello Dears
    I am using OAS 10g and calling a form from my web portal designed in ASP.Net. I pass userid and password to OAS as parameters and form is accessed but the problem is that userid and password are displayed in the address bar. How can I hide this info to secure my application.
    Note: This is a multi-user environment.
    Please guide. thanks
    Inayat Qazi

    On your reports server in the reports\conf directory there is a file called cgicmd.dat
    This file allows you to create a key that will be replaced with the entry from this file. You can put your userid and password parameters in here and thus remove them from the address line.
    Key value entries look like this in the file:
    examplekey: userid="scott/tiger@myoracleinstance" %*
    your url would then look like this:
    http://myreportsserver/servlet/rwservlet?examplekey&report=myreport.rdf&destype=cache

  • How to handle when login password is forgotten?

    Help!! Login password is forgotten!! How to handle??

    OS X 10.7 Lion, 10.8 Mountain Lion & 10.9 Mavericks
    Reset Password starting from Recovery HD
    Start the computer,then press and hold down command and R keys to start into recovery partition.
    When you see the Apple logo, release the keys.
    Wait until  OS X Utilities window shows up.
    Move the mouse to the menubar at the top and click "Utilities", then select "Terminal"
    from the drop down.
    Terminal window will appear.
    Type in   resetpassword   and press enter on the keyboard.
    Leave the Terminal window open.
    Reset Password Utility window will open with Macintosh HD selected.
    Select the user account from the popup menu box.
    Enter a new password.
    Reenter the new password for the user.
    Enter a hint.
    Click the "Save" button.
    Click  in the menubar and select Restart.
    Log in.
    If Keychain dialog box appears, select “Create New Keychain”.

  • How to hide login and password transported in interface ?

    Hi !
            In the current project that I´m working, the customer is developing a website in .Net and intend to use XI to communication between website and ECC 6.0. One of their needs is to create an interface to call a RFC in ECC 6.0 to validate login+password provided in the website(they created a Z table to persist login data, and a RFC to receive login and password and check in this table).
            My problem is, to solve this situation, I would use a simple sincronous interface but, the login+password information will be logged into monitoring screens of XI, and it´s not desireble, so I´m finding a way to hide this information.
            Initially, I was thinking to make 2 adapter modules, 1 to be used joined to the Sender SOAP Channel that will be used to the website call, that could get the data send by the website and encrypt it, to be sent to the XI pipeline encripted(only the fields login and password), and the 2nd to be used joined to the RFC Receiver channel, to decrypt login and password to be sent to the RFC call. Another alternative that I found was to use the MessageTransformBean and XLST mapping + java, but I´m looking for another alternatives.
            Somebody knows if there are some way to achieve this(hide some information in a message being processed by XI)?
            In time, I can´t to disable the logging of syncronous interfaces, because it´s customer requirement.
            Any help is welcome !
            Thank you in advance, and best regards,
            Wilson

    Hi !
            I have solved the problem.
            I used to develop 2 adapter modules, one to intercept the message arriving to SOAP Sender communication channel, encrypt the content of parametrized fields(in the module tab of the comm. channel) and deliver the updated message to the processing chain of the comm. channel.
            This message is so processed correctly by the XI pipeline, and delivered to the RFC Receiver Comm. Channel. I developed another adapter module to receive the data sent to the receiver RFC Comm. Channel, decrypt the contents of parametrized fields(like the another module, parametrized in the module tab), and deliver the updated message to the processing chain of the comm. channel.
            After some  tests, I verified that the message doesn´t remain logged unencrypted into XI(I checked Message Monitoring for Adapter Engine at Runtime Workbench, and the SXI_MONITOR trn).
            Like mentioned by Jaishankar, the SOAP Adapter initially didn´t accepted the module adapter that I wrote following the stardards existing in several documents about adapter modules here in SDN, but after some research, and debbuging sections of the adapter module, I achieved to develop the correct code to work.
            Thank you for your attention, and best regards,
            Wilson

  • How to hide keyboard input in a Java console application?

    I am developing a console application that request a password, but I don't wanna the password to be shown in the console when the user enters it.
    The source code is something like that:
    System.out.print("Password: ");
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in)) ;
    String password = "";
    try
           password  = in.readLine() ;
    catch (IOException e) {}
    return s ;

    Moderator advice: Please don't post in threads that are long dead and don't hijack another poster's thread. When you have a question, start your own topic. Feel free to provide a link to an old post that may be relevant to your problem.
    Moderator action: Locking this thread.
    Moreover, your question is answered in this thread. Didn't you at least read it before resurrecting it?
    db

  • How to hide external database password (Oracle) from Access users?

    We have users connecting to other databases (SQL Server/Oracle) through legacy Access databases. Right now the passwords are in the databases or on the user's computer in the DSN.
    Is there a way to abstract these passwords and prevent the user from being able to see them?
    We want to eventually retire these but for now we want to secure them.

    Hi,
    Please check out this link -
    FETCH DATA FROM ORACLE DATABASE USING Web Dynpro
    Regards,
    Lekha.

  • How to hide a input text field in a login form.

    First of all let me state i'm kind of new to AS3.
    I'm making a login form, and i've managed to make it work,
    but when the form actually moves frames, both the user_field, and
    password_field, remains visible...
    What am I missing to make those fields disappear?.
    Here is my code.
    Elliot J. Balanza
    thanks.

    If I understood your task correctly - why not to use
    object.visible = false of remove them from container?

  • How to hide username/password in JDBC program.

    hi All,
    The support tat I get here is simply gr8.
    Can someone suggest or send me a link as to how I hide the username /password ....i.e database connection in the jdbc program so as to avoid changing the program everywhere in case username and passwd changes ?????
    I simply want to change the following code
    String driverName = "oracle.jdbc.driver.OracleDriver";
    Class.forName(driverName).newInstance();
    // Create a connection to the database
    Sring serverName = "127.0.0.1";
    String portNumber = "1521";
    String sid = "oratest";
    String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" + sid;
    String username = "scott";
    String password = "tiger";
    connection = DriverManager.getConnection(url, username, password);
    Ta,
    sunny

    well i kind of support what my fellow poster neeelima.srtidhar said..
    Use of Connection Pooling via JNDI which is either provided by appln server or using custom built frameworks is the best method which i can think of instead of reinventing the wheel by creating a Properties file and then writing a Utility Class which ultimately endup in creating connection Object without any sort of optimal usage.
    checkout the below articles for reference of how to do it.
    http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html
    http://www.informit.com/articles/article.asp?p=352320&rl=1
    http://www.codeproject.com/useritems/pool_client_jboss.asp
    http://edocs.bea.com/wls/docs81/jdbc/programming.html
    http://www.castor.org/jdo-pooling.html
    http://homepages.nildram.co.uk/~slink/java/DBPool/
    and if you are thinking of reinventing those that could be possible using the below article
    http://www.javaworld.com/javaworld/jw-05-2002/jw-0517-jdbcdriver.html?page=1
    Hope that might help:)
    REGARDS,
    RaHuL

  • ORACLE 10g Reports- how to hide the parameter screen

    QUESTION:
    : I have a report that was designed in 6i. It has a parameter screen. Now I converted the report to 10g and pass parameters to the report from a form. Therefore the 6i parameter screen is not required. However, when I look into the report editor PAPER PARAMETER FORM icon, the old 6i parameter layout appears.
    HOW do I stop the 6i parameter screen from appearing? I dont need it anymore since the parameters are passed in from a form.

    Hi,
    Do this
    Go to DevSuiteHome_1\reports\conf\cgicmd.dat
    this file contains theMapping file for Oracle Reports
    see this link
    how to hide url (use, password and db) in oracle 10g

  • How to hide RMAN command line args from "ps -ef" command?

    Hi there
    This is not RMAN question per say but it is related to my RMAN script. Part of this RMAN script is below:
               rman target / catalog ${RMANID}/${RMANPW}@${RMANSID} log=${TMPFILE} << EOF
    While the script is running, if I issue "ps -ef | grep rman" command (from my own user id or as 'oracle' user), I see following:
              oracle   32522 32492 36 15:32 pts/1
    00:00:01 rman target / catalog rman/rman2013@rmancat log=/tmp/oratmp32492
    Is there a way to hide the values of the variables (Id, Pwd, SID) from the "ps -ef" command?
    If not, any other an alternates?
    Best regards

    How to Hide RMAN Passwords when Connecting to a Target Database (Doc ID 183377.1)
    How To Hide Usernames And Passwords In RMAN Logfile (Doc ID 246192.1)

  • How to hide report errors when user input incorrect?

    I have a tabular report with output that's limited on date interval basis in the WHERE clause. So I have two date items that's used to set start and end dates accordingly. Both items have validations "Item specified is a valid date". How to hide error in report area when validation fires?
    screenshot http://ehype.com.ru/tmp/rep_error.jpg

    Have you tried putting a condition on the report region of type "No Inline Validation Errors Displayed"?
    Scott

  • How to hide the password in .class file?

    Hi All,
    I try to use a Connect.java file to connect to MySQL. The URL is similar to the following:
    "jdbc:mysql://192.168.1.1/database?user=name&password=123456"
    When I compile the .java file to a .class file, I can still see the full URL line in the machine codes of the Connect.class file.
    How to avoid exposing the password in the line?
    Thank you.
    Anthony Pong

    1) Use obfuscate option in your Java compiler
    2) There is Jakarta tool BCEL - which can be used for
    obfuscation, etcObfuscation tools don't obfuscate single literal string contents, which is the problem here.
    You'll have to make sure that your string doesn't appear as a single string anywhere. One technique is to break up your password into pieces, and scatter the declarations around, and join them up in the code to construct your password.
    (Oh yeah, and don't call your variables "static private final String passwordPiece1="foo";" either :-), or use an obfuscation tool to hide these variable names).

Maybe you are looking for

  • Question about posting video in iWeb

    hi, I'm having problems with a video that's I've put on a page in iWeb. it's a quicktime mp4 of about 52 megs. but godaddy.com does not see the video on some sites, and on others it boots very slowly is that too big a video to post? should I do a web

  • What is the best FM transmitter/charger for my 6gen nano?

    What is the best FM transmitter/charger for my 6th gen Nano?  I want to use it in my car.

  • Drag and drop error in new acrobat pro 11

    I would be able to drag pages from a PDF opened in Internet explorer and drop the pages I wanted to a PDF opened in acrobat pro. In version 10 this worked but now in 11 it does not. How do i get this function to work again?

  • Search help exit while user double click

    Hi, As it was done earlier but while test facing some issue,Double clicked value from the output is not returned to input screen whatever thevalues only last value is returning to the screen please ooverview some of my code, IF callcontrol-step = 'DI

  • 10g cluster installs

    All, I am having problem on getting installation of 10g cluster stared. I am installing CRS on the cluster, the first node install successfully. But the second node is hanging on "root.sh" script: Running Oracle10 root.sh script... \nThe following en