I have the following problem: I have an application that needs some passwords for git and a db etc. I want to write all the passwords into a file, so the user doesn't have to enter all the passwords after starting the application. The user enters only a masterpassword and then all the other passwords can be decrypted and encrypted ( if he enters a new password ) with his masterpassword. The code should look like this:
//Decryption String masterPassword = getMasterpassword() String encryptedPassword = getPasswordFromFile("git") String clearPassword = decryptPassword(encryptedPassword, masterPassword) //Encryption String masterPassword = getMasterpassword() String clearPassword = getClearPassword("Please enter the password") writeToFile("git",encryptPassword(clearPassword, masterPassword)
I don't need a incredibly secure encryption. It's important, that the encryption is not done randomly, because i have to decrypt the password after the restart of the application.
Btw. I'm using Scala. But an it doesn't matter if the explanation is for Java or Scala.
I realy hope you can help me! Thanks!