Answered step by step
Verified Expert Solution
Question
1 Approved Answer
c + + Password Manager Program Write a class called UserPasswordManager that contains the following: Private Data: Boolean value for a valid password, a string
cPassword Manager Program
Write a class called UserPasswordManager that contains the following:
Private Data:
Boolean value for a valid password, a string for the current password, and a vector of strings for old passwords. You will not store any passwords, current or old, that are not encrypted.
Private Functions:
createPassword: This function will ask the user for a password, send it to a validatePassword function and if it is a valid password, send the password to an encryptPassword function that will return the current encrypted password to be stored.
validatePassword: This function will check the password to make sure that it adheres to the following rules:
Must contain at least characters.
Must contain at least one lowercase letter.
Must contain at least one uppercase letter.
Must contain at least one digit.
Must contain at least one of the following special characters:
@ # $ ~ & :
Any other special characters including spaces are NOT allowed.
Must NOT be a previously used password.
encryptPassword: This function takes in a valid password and encrypts it using the following encryption scheme:
For any uppercase letters, you will sum the decimal values of the letters and then use the total to create a number in a range of values similar to ranging the rand numbers This value will then be the offset for your uppercase letters.
For lowercase letters, you will sum the decimal values of the letters and then use the total to create a number in a range of values similar to ranging the rand numbers This value will then be the offset for your lowercase letters. Notice it is the same thing you did for uppercase
For digits, you will sum the decimal values of the digits and then use the total as you would to create a number in a range of values similar to ranging the rand numbers This value will then be the offset for your digits.
Uppercase, lowercase, and digits all should have their own offsets.
You will then use your offsets as you go through each character in your password and offset add to its value by your calculated offset. Be sure to wrap as necessary. eg If you had the letter h and the offset was then the encrypted letter would be u If you had the letter P with an offset of then your encrypted letter would be c having to wrap when it gets to the end of the alphabet.
There is no offset for special characters. Special characters do not change in the encryption.
Once you have the new encrypted string, you will then add numeric digits to the beginning of the string in the following format: first two digits are the uppercase offset, the next two digits are the lowercase offset, and the last digit is the offset for the digit. This can be used later to decrypt the password however not in this assignment!
The final combined encrypted string is to be returned.
Public functions:
Default constructor: That will call the createPassword function and use the Boolean value to either display Password Created or Password could not be created
changePassword: This function will ask the user for a new password. This new password will have to be validated. If the new password is valid, then the old encrypted password will be added to the old passwords vector and a message stating that Password was successfully changed will be returned or if the new password is not valid, then a message stating, Password was not changed will be returned.
verifyPassword: This function will accept a password to verify. You will have to encrypt this password using your function in order to compare it to the current encrypted password. This function will either return a true or false Boolean value.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started