I have managed to break the second post down into two jar files. I want to be able to use a command line, pass a password to it, and generate and encrypted password. This is step one (which I have successfully done). My output now is two things:
1) An encrypted password
2) a key, who's output is something like: javax.crypto.spec.SecretKeySpec@######
My problem is now the second part. I want to have another program that decrypts those into a password that can then be sent to log into an application.
My issue is that I cannot seem to set the key in the decrypt program manually. I really only have code to generate it.
Like it would be great to do something like
SecretKeySpec key = args
But that is impossible because SecretKeySpec is not a string and that output is also not the key, but fully-qualified-class-name@hashcode
I guess my issue really boils down to this: I need to store an encrypted password in a config file that was created by program1. I need another program (program2) to be able to decrypt it. But how do I do that if program2 does not have the key that used to encrypt the password in program1?
I feel like I am going to a totally wrong path here, any guidance to get back on track would be greatly appreciated.