Open Source Password Management Software Project Description (attachment code)

xiaoxiao2021-03-06  112

First, introduction

Software Name: Open Source Password Management Software Development Language: JavamIDP Version: 1.0 Development Environment: CodeWarrior J2ME WTK1.03 Test Environment: J2ME WTK1.04 Chinese Supplement Pack

Introduction: With the development and progress of society, there are many password information that everyone needs memory. Such as bank card password, mailbox password, forum password, etc. This software implements all kinds of password information for the user's mobile phone, stores and manages users. Main features: 1, increase your password. The new password is stored. In the new password, the user can store the password ID, that is, password use, password, and note information. 2, check the password. View, modify and delete existing passwords. 3, set the password. You can set your password for the software. That is, when using this software in the phone, the user needs to enter the password to enter. It has been provided to delete the password function.

If you have any good suggestions, please contact me, CQUCYF @ 263.net 2, use J2ME WTK to compile and run the source code 1, create a new project in KToolbar: Project Name: Arbitrary (for example, PM) MIDlet class name: PM.Core.PasswordManagerMIDlet2, copy the source code to the Apps in your J2ME WTK installation directory, the path is: Project Name / SRC // PM / C: / J2ME WTK installed in C: / J2mewtk directory The project name is PM, the full path is: C: / J2MewTK / Apps / PM / SRC / PM / Core3, compile and run the project using KToolbar.

Remarks: If you need to display the Chinese name in the simulator, you can change the NAME to "Open Source Password Management Software" under the SETTING / MIDlets in the KTOOLBAR in the case where the item is turned on. Third, the source code / ** * Copyright 2004- * Author: Chen Yuefeng * email: cqucyf@263.net * This code you can reuse, repost, but please do not remove all of the information at any time * In terms of business Use the author, please contact the author * version number: 0.90 * Completion time: 2004-7-07 * Modification time: 2004-8-17 * / package pm.core;

Import java.io. *; import javax.microedition.midlet. *; import javax.microedition.lcdui. *; import javax.microedition.io. *; import javax.microedition.rms. *;

/ ** * Password Management Software * Realizes saving commonly used password information in your phone. Such as bank password, mailbox password, etc., the software does not access the network, so it will never leak your personal privacy.

* / public class passwordManagermidlet Extends MidletManagermidletListener {// Display Object Display Display; // Topic String Title = "Open Source Password Management Software"; // Software Main Interface List Lstmain; // Main Interface Determined button Command Cmdentermain; // Exit button Command cmdExit; // increase password interface Form frmAddPassword; // password ID TextField tfId; // password TextField tfPsswordAdd; // confirm password TextField tfConfirmPasswordAdd; // Memo information TextField tfRemark; // OK button Command cmdEnterAdd; // return button Command cmdbackadd; / / View password main interface list lstView; // View Detail button Command cmdinfo; // Return button Command cmdbackViewMain; / / View display details window textbox tbviewinfo; // Remove button Command cmddelView; // modify button Command cmdModify; // return button Command cmdBackViewInfo; // Check to change the password in the password window Form frmViewModifyPassword; // password text box TextField tfPasswordView; // confirm password text box TextField tfConfirmPasswordView; // modify button Command cmdModifyView; // Return button Command cmdbackViewModify; // Set the secret Code interface Form frmSetPassword; // password TextField tfPassword; // Confirm password TextField tfConfirmPassword; // OK button Command cmdEnterSetPassword; // return button Command cmdBackSetPassword; // Delete button Command cmdDelSetPassword; // Form frmHelp help interface; // help screen Back button Command cmdbackhelp; // About interface form frMabout; // About the return button Command cmdbackabout; // prompt window Alert alert; // Input password interface FormstartPassword; // Password Enter text box textfield TfStartPassword; / 密 按 按 按 c c 密 内容 内容 内容 内容 内容 内容 内容 内容 内容 内容 内容 内容 内容 内容 内容 号 内容 内容 内容 号 号 内容 号 号 号 号 内容 内容,, 内容 号 号 号, 内容 号 号; 号 号 号 号 号 号 号The representative of the array subscript is the first password ID, 1 represents the second, and pushes int [] IDINDEX;

/ ** * Initializing interface element * / public passwordManagermidlet () {// Initializes display object Display = display.getdisplay (this); // Initialization Main Form Lstmain = New List (title, list.implicit); Lstmain.Append ( "Increase", NULL; LSTMAIN.APPpend ("View", NULL); LSTMAIN.APPpend ("Settings", NULL); LSTMAIN.APpend ("Help", NULL); LSTMAIN.APpend ("About", NULL) ; // Initialize the main interface determination button cmdentermain = new command ("OK", command.ok, 1); // Add to the main interface Lstmain.addCommand (cmdentermain); // Initialization Exit button cmdexit = new Command ("exit" Command.exit, 1); // Add to the main interface LSTMain.addcommand (cmdexit); // Initialization Add password interface frmaddpassword = new form (title); TFID = New TextField ("Password ID:", ", 100 Textfield.Any; tfpsswordadd = new textfield ("Password:", ", 20, textfield.password); tfconfirmpasswordadd = new textfield (" 1 Confirm password: ",", 20, textfield.password); tfremark = New TextField ("Note:", ", 100, TextField.Any); cmdenteradd = new Command (" OK ", Command.ok, 1); cmdbackadd = new Command (" Return ", Command.back, 1); // Add to increase password interface frmaddpassword.append (tfpssword, "frmaddpa; frmaddpa ssword.append (tfConfirmPasswordAdd); frmAddPassword.append (tfRemark); frmAddPassword.addCommand (cmdEnterAdd); frmAddPassword.addCommand (cmdBackAdd); // initialize the password to view the main interface lstView = new List (title, List.IMPLICIT); cmdInfo = new Command ("View", command.screen, 1); cmdbackviewmain = new command ("Return", command.back, 1); // Add to view password main interface Lstview.addcommand (cmdinfo); lstiew.addcommand (cmdbackviewmain) ; // Initialize View Password Details Interface TBViewInfo = New TextBox ("Details", ", 200, TextField.Any); cmddelview =

New Command ("Delete", Command.Screen, 1); CmdModify = New Command ("Modify", Command.Screen, 1); cmdbackViewinfo = New Command ("Return", Command.back, 1); // Add to For more information view the password interface tbViewInfo.addCommand (cmdDelView); tbViewInfo.addCommand (cmdModify); tbViewInfo.addCommand (cmdBackViewInfo); // initialize view the Change password interface frmViewModifyPassword password in = new Form ( "Change password"); tfPasswordView = New Textfield ("Password:", ", 20, TextField.password); TFConfirmpasswordView = New TextField (" Confirm Password: ",", 20, TextField.Password); cmdmodifyView = New Command ("OK", Command. OK, 1); cmdBackViewModify = new Command ( "return", Command.BACK, 1); // add to change the password interface frmViewModifyPassword.append (tfPasswordView); frmViewModifyPassword.append (tfConfirmPasswordView); frmViewModifyPassword.addCommand (cmdModifyView); frmViewModifyPassword .addcommand (cmdbackviewmodify); // Initialization Setting Password interface frMsetPassword = new form ("setting password"); tfpassword = new textfield ("Password:", ", 20, textfield.password); tfconfirmpassword = new textfield (" confirmation Password: "," ", 20, textfield.password); cmdent ERSETPASSWORD = New Command ("OK", Command.ok, 1); cmdbackSetPassword = New Command ("Return", Command.back, 1); cmddelsetPassword = New Command ("Delete", Command.Screen, 1); // Add to set a password interface frmSetPassword.append (tfPassword); frmSetPassword.append (tfConfirmPassword); frmSetPassword.addCommand (cmdEnterSetPassword); frmSetPassword.addCommand (cmdBackSetPassword); frmSetPassword.addCommand (cmdDelSetPassword); // initialize help interface frmHelp = new Form ( "Help"; frmhelp.append ("Open Source Password Management Software is a software that helps you manage various passwords, /" Add / "can add new passwords, /" Take Out / "

You can view, modify, and delete existing passwords, / "Setting /" can perform the entry password setting of the software.

"); // Initialization return button cmdbackhelp = new command (" Return ", command.back, 1); // Add to Help Interface FRMHELP.ADDCOMMAND (CMDBACKHELP); // Initialization About Interface FRMABOUT = New Form (" About. " .. "); frmAbout.append (" Copyright 2004- author: Chen Yuefeng email: cqucyf@263.net welcome your suggestions to update the version of "); // initialize the return button cmdBackAbout = new Command (" return ", Command .Back, 1); // Add to the interface frMabout.addcommand (cmdbackabout); // Initialization prompt window Alert = new alert (title); // Initialization The password interface frmstartpassword = new form (title); // Initialize the password input text box tfstartpassword = new textfield ("Please enter your password", ", 20, textfield.password); // Initialization determination button cmdenterstart = new Command (" OK ", Command.ok, 1); // add to the password interface frmStartPassword.append (tfStartPassword); frmStartPassword.addCommand (cmdEnterStart); frmStartPassword.addCommand (cmdExit); // event handler lstMain.setCommandListener (this); frmHelp.setCommandListener (this); frmAbout.setCommandListener ( this); frmStartPassword.setCommandListener (this); frmSetPassword.setCommandListener (this); frmAddPassword.setCommandListener (this); lstView.setCommandListener (this); tbViewInfo.setCommandListener (this); frmViewModifyPassword.setCommandListener (this); / * // Test Code, add record try {= recordstore.OpenRecordStore ("Password", true); RS.SETRECORD (1, New String ("123456"). GetBytes (), 0, 6); // system.out.println I); rs.closecordstore ();} catch (exception e) {system.out.println ("Test Code - Add Record: E);

} // Test code, delete all record sets Try {recordstore.deleteRecordStore ("ID"); RecordStore.deleteRecordStore ("remote"); Remark "); RecordStore.deleteRecordStore (" flag "); // RecordStore.deleteRecordStore ("password");} catch (exception e) {system.out.println (e);} * /} / ** * startup method * / public void startapp () {TRY {// Open password record RS = RecordStore.OpenRecordStore ("Password", false); // Read password Byte [] b = rs.getRecord (1); password = new string (b, "ISO8859_1"); // Close Record Rs.closecordStore ); // Display input password interface Display.setCurrent (frmstartpassword);} Catch (Exception E) {// No password record, display main interface Display.setCurrent (LSTMAIN);}} public void designApp (Boolean unconditional) {}

Public void pauseapp () {} / ** * Event Processing * / public void commandion (Command C, Displayable S) {// Processes the determination button event IF in the password window at the startup, f (c == cmdenterStart) {// user Entered password string pwd = tfstartpassword.getstring (); // Determine if the user input is empty if (PWD == Null || PWD.Length () == 0) {// Enter is empty // Show warning prompt DISPLAYALERT "Please enter your password!");} Else {// input is not empty // compare password IF (PWD.Equals (password)) {// password correct // Display main interface Display.setCurrent (LSTMAIN);} else { // Password Error // Display Warning Prompt DisplayAlert ("Password error, re-enter!");}}} // handle exit event if (c == cmdexit) {destroyApp (false); notifyDestroyed ();} // Handling Select IF (c == cmdentermain) {int index = LSTMAIN.GETSELECTEDINDEX (); //system.get.println (index); // Select "Add" IF (INDEX == 0) {// Display adding password interface Display.setCurrent (frmaddpassword);} // Select "View" if (index == 1) {// Get password ID list TRY { // Open the FLAG Record Set RecordStore Rstemp = RecordStore.OpenRecordStore ("Flag", True); // Open ID Record Set RS = RecordStore.OpenRecordStore ("ID", true); // Get the number of records recorded in INT NUM = rs.getnumRecords (); // Initialization password ID index array idindex = new int [Num]; // Create an array ID = new string [num]; // read ID information into ID array INT j = 0; // represents the subscript for the array (INT i = 1; i <= NUM; i ) {// If the value in the FLAG record is 0, then read, 1 means delete, not reading String FlagTemp = New String (RSTEMP.GETRECORD (I)); //system.out.println ("" "

i ":" flagtemp); if (FlagTemp.equals ("0")) {idIndex [j] = i; // Get the corresponding relationship ID of the index number displayed in the recordset [J] = New String (gtrecord (i), "GB2312"); J ;}} // Clear LSTVIEW in the display for (INT i = LSTVIEW.SIZE () - 1; I> = 0; I -) {Lstview. Delete (i);} // Display ID information in the LSTVIEW in For (int i = 0; i

0) {// Determine the password and confirmation password is the same IF (PWD1.Equals (PWD2)) {// Set password try {// Open password record RS = RecordStore.OpenRecordStore ("Password", true); // system. Out.println ("rs.getnumrecords ():" gtnumRecords ()); // Determine if the password IF has been set (rs.getnumRecords ()> 0) {// set the password RS.SetRecord (1, PWD1. Gettes (), 0, pwd1.length ());} else {// does not set password rs.addRecord (PWD1.GetBytes (), 0, pwd1.length ());} // Close Record rs.closecordStore () / / Tip to modify success DISPLAYALERT ("password setting success");} catch (exception e) {//system.out.println (E); // Setting failed displayalert ("Password setting failed!");}} {// prompt the user password and confirmation password must be the same DISPLAYALERT ("Password and confirmation password are not the same");}} Else {// prompt user password and confirmation password cannot be empty DISPLAYALERT ("Please check the password and confirm that the password is empty ! ");}} // Handling the return button IF in the help interface {// Display Main Interface Display.SetCurrent (LSTMAIN); } // Process the return button IF (c == cmdbackabout) {// display main interface display.setCurrent (} // process the return button IF in the password interface;} // processing the return button IF in the password interface {/ / Display Main Interface Display.setCurrent (LSTMAIN);} // Process the determination button event if the password interface is added (c == cmdenteradd) {string idAdd = tfid.getstring (). ToString (); // id string passwordadd = tfPsswordAdd.getString (); // password String confirmPasswordAdd = tfConfirmPasswordAdd.getString (); // Check password String remarkAdd = tfRemark.getString (); // // NOTE determines whether the input complete data, notes may be empty if (idAdd.length ()! =

0 && passwordadd.length ()! = 0 && confirmpasswordadd.Length ()! = 0) {// Compare password and confirmation password is the same if (PasswordAdd.equals (confirmpaalswordadd) {// Write record set TRY {// Write ID = RecordStore.OpenRecordStore ("ID", true); rs.addRecord (iDadd.getbytes (), 0, idadd.getbytes (); rs.closecordstore (); // Write password RS = RecordStore.OpenRecordStore ("PWD", true); rs.add.getBytes (), 0, passwordadd.getbytes (). Length); rs.closecordStore (); // Write Remark RS = RecordStore.OpenRecordStore (" Remark ", true); RS.AddRecord (RemarkAdd.getBytes (), 0, remarkdd.getbytes (); length); rs.closecordStore (); // Write to delete the tag, 0 represents normal, 1 generation delete RS = RecordStore.OpenRecordStore ("Flag", true); Rs.AddRecord (New String ("0"). GetBytes (), 0, 1); rs.closecordstore (); // Tip password Add success DisplayAlert ("Increase Success! ");} Catch (Exce) Ption e) {// Display Warning Information DisplayAlert ("Add password failed! ");}} Else {// Display Warning Information DisplayAlert (" Password and Confirmation Password are the same! ");}} Else {// Display Warning Information DisplayAlert (" Please check if the input is complete! ");}} // Processing the return button if (c == cmdbackViewMain) in the password main interface {// Displays the main interface Display.setCurrent (LSTMAIN);} // Processing View button event IF in the main interface of the password (c == cmdinfo) { INDEX = LSTVIEW.GETSELECTEDINDEX (); // Need to view the information ID // If there is no record, return to IF (INDEX == -1) return;

// Get information string s1 = getInfobyid (IDindex [index]); if (s! = Null) {// Display to TBViewinfo.setString (S1);} else {// Display prompt information, see failed displayalert (" Unable to get more information ");} // Display password detail interface Display.SetCurrent (TBVIEWINFO);} // Processing the return button event if (c == cmdbackViewinfo) {// display View password main interface Display.SetCurrent (LSTVIEW);} // Processing the modification button event if (c == cmodiffify) {// displays the password interface display.setCurrent (frmviewModifyPassword);} // processing password details interface Delete Button Event If (c == cmddelview) {// View the selected index number INDEX = LStView.getSelectedIndex (); // Delete the content in the record set Try {// In the record set in the FLAG content in the record set Write delete tag = RecordStore.OpenRecordStore ("flag", true); rs.seTRecord (iDINDEX [INDEX], New String ("1"). GetBytes (), 0, 1); rs.closecordStore (); / / Return to the main interface Display.setCurrent (LSTMAIN);} catch (exception e) {system.out.println (e); // Display Warning Information Displaya LERT ("Delete password failed, please try again! ");}} // Process the return button event if the password interface is (c == cmdbackViewModify) {int index = LStView.getSelectedIndIndex (); // Need to view the information ID // get information string S1 = getInfobyid (IDIndex) [index]); if (s! = null) {// Display TBViewinfo.setString (S1);} else {// Display prompt information, see failure DisplayAlert ("Unable to get detailed information");} // Display password detail interface Display.setCurrent (TBVIEWINFO);} // Process the modification button event if (c == cmdmodifyVIEW) {// password box user input String PWD1 = tfpasswordView.getstring ();

// Confirm the password box user Enter String PWD2 = tfconfirmpasswordView.getstring (); // Determine the user's input IF (PWD1.Length ()! = 0 && pwd2.length ()! = 0) {// User Enter the password and Confirm password // judgment password and confirmation password is the same if (PWD1.Equals (PWD2)) {// The same int index = LstView.getSelectedIndex (); // Need to view the information ID / / Change password TRY {// Change password RS = RecordStore.OpenRecordStore ("PWD", true); rs.seTRecord (IDindex [index], pwd1.getbytes (), 0, pwd1.length ()); rs.closecordStore (); // Display // Get information String S1 = getInfobyid (IDIndex [index]); if (s! = Null) {// Displays TBViewinfo.setString (S1);} else {// Display prompt information, view failback DISPLAYALERT ("Unable to get details ");} // Display password detail interface Display.SetCurrent (TBVIEWINFO);} catch (exception e) {// Display modification failed DisplayAlert (" Modify Password Failure ");}}}}}}}} ELSE {// Due to The password and confirmation password are not the same DISPLAYALERT ("Password and confirmation password!");}}}} Else {// password or confirm password, user does not enter // Tips User Enter DisplayAlert ("Please check if the input is complete, where the password and the confirmation password cannot be empty!"); // Determine if the user has set a password RS = RecordStore.OpenRecordStore ("password", true); int NumTemp = rs.getnumRecords (); // Record the number of records in the records Rs.closecordStore (); // User has set password IF (NumTemp> 0) {// Remove, completely delete RecordStore.deleteRecordStore ("password"); // Tips to delete password success displayalert ("Delete password successfully, return!");} else {// user does not set a password / / Tip has not yet set DISPLAYALERT ("You have not set a password, you can't delete it! ");

转载请注明原文地址:https://www.9cbs.com/read-101905.html

New Post(0)