In Java I would like to generate a public and private key based on a string in my app.
I'm not going for security, I'm going for "Can I generate the same public and private key using this string".
How would I do that?
I was looking at these methods:
KeyPairGenerator keyGen = KeyPairGenerator.getInstance("DSA", "SUN");
SecureRandom random = SecureRandom.getInstance("SHA1PRNG", "SUN");
keyGen.initialize(1024, random);
But I want to seed the key pair generator with my own string, which ideally will get hashed by these algorithms. KeyGen only takes the SecureRandom
object. I want the same resulting key pair, anytime I pass that string.