Home Answers Viewqa Swing-AWT Authentication of password

 
 


manjiri
Authentication of password
4 Answer(s)      4 years and 6 months ago
Posted in : Swing AWT

View Answers

December 16, 2008 at 7:04 AM


check out the below link

December 17, 2008 at 12:39 AM



December 17, 2008 at 6:08 AM


Hi friend,



I am sending running code, please implement this code.

import java.io.*;
import javax.crypto.Cipher;
import javax.crypto.BadPaddingException;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.KeyGenerator;
import java.security.Key;
import java.security.InvalidKeyException;

public class EncryptData {
private static String algo = "DESede";

private static Key genkey = null;

private static Cipher cipher = null;



private static void setUp() throws Exception {

genkey = KeyGenerator.getInstance(algo).generateKey();

cipher = Cipher.getInstance(algo);

}





public static void main(String args[]) throws Exception {

String str = "";
setUp();

if (str ==null && str=="") {

System.out.println("Please enter String.");

System.exit(1);

}

byte[] enByte = null;

String inputStr = args[0];

System.out.println("Entered: " + inputStr);

enByte = enDt(inputStr);

String str1 = enByte.toString();

String str2 = dedt(enByte).toString();

System.out.println("Input String: " + inputStr);

System.out.println("Encrypt code: " + str1);

System.out.println("Decrypt code: " + str2);
}



private static byte[] enDt(String inputStr)

throws Exception {

cipher.init(Cipher.ENCRYPT_MODE, genkey);

byte[] inputStrBytes = inputStr.getBytes();

return cipher.doFinal(inputStrBytes);

}



private static String dedt(byte[] enByte)

throws Exception{

cipher.init(Cipher.DECRYPT_MODE, genkey);

byte[] recByte = cipher.doFinal(enByte);

String recovered = new String(recByte);

return recovered;

}

}

-----------------------------------

Thanks.

December 17, 2008 at 6:40 AM


I am sending running code. If you have any problem then explain in detail.


import java.io.*;

public class PasswordField {

public static String readPassword(String prompt) {
EraserThread eraser = new EraserThread(prompt);
Thread mask = new Thread(eraser);
mask.start();

BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String password = "";

try {
password = in.readLine();
}
catch(IOException ioe) {
ioe.printStackTrace();
}
// stop masking
eraser.stopMasking();
// return the password entered by the user
return password;
}
}

-----------------------------------------

import java.io.*;

class EraserThread implements Runnable {
private boolean stop;

// The prompt displayed to the user

public EraserThread(String prompt) {
System.out.print(prompt);
}

//Begin masking display asterisks (*)

public void run () {
stop = true;
while(stop) {
System.out.print("\010*");
try {
Thread.currentThread().sleep(1);
}
catch(InterruptedException ie) {
ie.printStackTrace();
}
}
}

//Instruct the thread to stop masking

public void stopMasking() {
this.stop = false;
}
}
------------------------------------------

public class TestApp {
public static void main(String args[]) {
String pwd = PasswordField.readPassword("Enter password: ");
System.out.println("The password entered is: "+pwd);
}
}
--------------------------------------

Visit for more information.

http://www.roseindia.net/java/example/java/swing/

Thanks.









Related Pages:
Authentication of password - Swing AWT
Authentication of password  System level authentication of password.... How the Printed password gets converted into the asteric (*) mark... BufferedReader(new InputStreamReader(System.in)); String password
Basic authentication
Basic authentication       Basic authentication is the process through which a web server authenticates an entity with a user name and password received by the user by using
Sending email without authentication
Sending email without authentication  Hi sir, Am doing a project in JSP, in that i want to send mail without any authentication of password so send me code as soon as possible.   Please visit the following links
http Client Authentication
authentication problem. can any one please help me to solve this problem. please... UserId="adm"; String Password="adm"; String postTitle="Pls11...().encode((UserId+":"+Password).getBytes()))); System.out.write(entry
JDbc Login Authentication
Authentication Using ComboBox.From Servlet and jsp with sessions I am new to sessions...;<td align="left">Password:</td><td><input type="password" name="password" size="20"></td></tr> <tr><td align
login authentication - Development process
login authentication  hi.. how to validate username and password for both admin and user using java script which is retrive from backend
login authentication - Java Beginners
qry = "select username, password from register where username='"+username+"' and password='"+password...("username"); password=rs.getString("password
Login Authentication using existing Active Directory.
Login Authentication using existing Active Directory.  I need jsp code for login authentication of username and password using already existing... be Such that there should be no inputs for code other than username, password and LDAP
Login authentication & mysql - Java Beginners
Login authentication & mysql  Hi , Could you guide or provide sample coding for the following scenerio. I need to code authentication for user... their personal account with the username and password, must save it in database (MySQL
Java Glossary : Authentication
Java Glossary : Authentication       Authentication is the process of ensuring to some in order... it claims to be. This types of services works on shared secrets like password
recovery of password through mail
recovery of password through mail  hi i want code for login page authentication in jsp with oracle database.it should be similar to any mail login... user account should be verified and if they forgot password then security question
PHP User Authentication Login and password check Tutorial
to the database. $dbname="name"; #Password to verify its you. $dbpass="
Spring Security HTTP basic authentication
Spring Security HTTP basic authentication In this section, you will learn about the HTTP basic authentication in Spring Security. You can configure HTTP basic authentication in spring-security.xml as follows : <!--Spring
Password
Password  make a program which ask ask the username and password * in this format. in C language
Authentication - JavaMail
Authentication program in Java  How to write a program in Java for user authentication
Authentication in Servlets
Authentication in Servlets  What are different Authentication options available in Servlets
Authentication in Web Application
Authentication in Web Application   ... you how to authenticated the user against database user name and password... database password. User enters the username and password on the JSP page
Spring Security Password Hashing
Spring Security Password Hashing In this section, you will learn about Password Hashing in Spring Security. In the Spring Security Authorized Access Using Custom Login Form  example, the password is stored directly using clear
Authentication - Struts
Authentication  Hello everybody, How to provide high level authentication in struts application
Login authentication
Login authentication  i want d code for login authentication from mysql database on the same pc using swings
Login authentication
Login authentication  i want d code for login authentication from mysql database on the same pc using swings
gmail authentication
browser window it asks for authentication how it is possible if anybody knows plz tell... request Authentication done using Session If you signout and paste URL It Ask
Login Authentication using Bean and Servlet In JSP
Login Authentication using Bean and Servlet In JSP... developed a web application of login authentication using Bean  in JSP. Five... a Servlet  "login.java" to validate the username and password from
HTTP Authentication With PHP
HTTP Authentication with PHP: The HTTP Authentication is available when... to send a message (for authentication) to the client side (browser... for authentication. $_SERVER and $HTTP_SERVER_VARS contains these predefined
iphone nsurlrequest authentication
iphone nsurlrequest authentication   How to authenticate a form in iPhone Application
windows authentication with hibernate - Hibernate
windows authentication with hibernate  Does anyone know how to setup a datasource for SQL Server that uses Windows authentication instead of SQL Server mixed mood authentication? Is it possible with hibernate framwork? Thanks
SSL Authentication - JSP-Servlet
SSL Authentication  With the help of a sample code describe the use of SSL Authentication of java clients
redirecting a login authenticated form to a form to be displayed on the same page from where the login authentication has taken place.
page from where the login authentication has taken place.  I am...;The given code accepts username and password from the user and check whether the user...; function validate(){ var username=document.form.user.value; var password
login authentication - Java Beginners
login authentication  i 've designed the jsp page for login. now i need to connect it with the bean and do authentication for the login for the "register" table in mysql. can anybody help me with the code immediately
forgot password?
forgot password?  forgot password
password check
password check  how to check sighup passowrd and login password
Struts Login Authentication
Struts Login Authentication  Hi Sir, Am doing a project in a struts 1.2,i want login authentication code fro that, only authenticated user can login into application,i am using back end as Mysql.so send me code as soon
change password
change password  how to change password in the login form.... by giving options to user like this old password, new password.. pls help
Reset Password
Reset Password  coding for reset password
retype password
retype password  coding for retype password
forget password?
forget password?  can anyone help me? how to create a module of forget password?the password can reset by generate random password and send to user's email..i develop the php system using xampp and dreamweaver
forget password?
forget password?  can anyone help me? how to create a module of forget password?the password can reset by generate random password and send to user's email..i develop the php system using xampp and dreamweaver
forget password
forget password  codding for forget password using spring framework
user authentication code in php - PHP
user authentication code in php  Hi, Can you please send me a user authentication code in php? or just post the guidelines to authenticate a user. Thanks
Forgot password
Forgot password  hi i want to develop a code for when user clicks on forgot password then the next page should be enter his mobile no then the password must be sent to his mobile no...! Thanks in advance Nag Raj
password change
password change  Hi , I am using jsf and trying to write a code to change the password of a user . Ihave to retrine userid fromdata base how to do that using session