Authentication of password



Share on Google+Share on Google+

Authentication of password
4 Answer(s)      8 years 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 javax.crypto.Cipher;
import javax.crypto.BadPaddingException;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.KeyGenerator;

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 = "";

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

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



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;





December 17, 2008 at 6:40 AM

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


public class PasswordField {

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

BufferedReader in = new BufferedReader(new InputStreamReader(;
String password = "";

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



class EraserThread implements Runnable {
private boolean stop;

// The prompt displayed to the user

public EraserThread(String prompt) {

//Begin masking display asterisks (*)

public void run () {
stop = true;
while(stop) {
try {
catch(InterruptedException ie) {

//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.



Related Tutorials/Questions & Answers:
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(; 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
Password  make a program which ask ask the username and password * in this format. in C language
Authentication in Servlets
Authentication in Servlets  What are different Authentication options available in Servlets
Authentication - JavaMail
Authentication program in Java  How to write a program in Java for user authentication
PHP User Authentication Login and password check Tutorial
to the database. $dbname="name"; #Password to verify its you. $dbpass="
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
Authentication - Struts
Authentication  Hello everybody, How to provide high level authentication in struts application
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
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
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
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
SSL Authentication - JSP-Servlet
SSL Authentication  With the help of a sample code describe the use of SSL Authentication of java clients
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 - 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
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
forgot password?
forgot password?  forgot 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 send me code as soon
password check
password check  how to check sighup passowrd and login password
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
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
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
retype password
retype password  coding for retype password
Reset Password
Reset Password  coding for reset password
recovery of password through mail
recovery of password through mail  hi i want code for login page authentication in jsp with oracle should be similar to any mail login... user account should be verified and if they forgot password then security question
forget password
forget password  codding for forget password using spring framework