Skip to content

Ryanczj0306/encrypt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Project-3 encryption example

Example of storing encrypted password in database and verifying against encrypted password

To run this example:

  1. Clone this repository.
  2. Open IntelliJ -> Open -> Choose the project you just cloned (The root path must contain the pom.xml!) -> The IntelliJ will load automatically.
  3. Go to UpdateSecurePassword.java, make sure to change your mysql username and password.
  4. Run UpdateSecurePassword.java on your local machine, it will update the passwords in your existing moviedb customers table from plain text to encrypted string.
  5. Go to VerifyPassword.java, also change your mysql username and password. This program will verify if the email and password are valid.

To run it on AWS under command line:

  1. Clone this repository using.
  2. cd cs122b-project3-encryption-example
  3. change your mysql username and password in UpdateSecurePassword.java and VerifyPassword.java
  4. mvn compile
  5. Have a backup of the "customers" table, run the following:
    create table customers_backup(
    id integer auto_increment primary key,
    firstName varchar(50) not null,
    lastName varchar(50) not null,
    ccId varchar(20) not null,
    address varchar(200) not null,
    email varchar(50) not null,
    password varchar(20) not null,
    foreign key(ccId) references creditcards(id));
    insert into customers_backup select * from customers;
  6. to run UpdateSecurePassword:
    mvn exec:java -Dexec.cleanupDaemonThreads=false -Dexec.mainClass="UpdateSecurePassword"
  7. to run VerifyPassword:
    mvn exec:java -Dexec.cleanupDaemonThreads=false -Dexec.mainClass="VerifyPassword"
  8. When execute java program using maven in command line, if the program doesn't exist after it finishes, you can just kill it.
  9. To recover the data in the "customers" table, run the following:
    update customers C1 set password = (select password from customers_backup C2 where C2.id = C1.id);

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published