I am generating an AES key as in follows and converting the key into a string.
try{
SecretKey secretKey = KeyGenerator.getInstance("AES").generateKey();
String encodedKey = Base64.getEncoder().encodeToString(secretKey.getEncoded());
}catch(Exception ex){}
Now I need to store and distribute this key to a different location ( eg : Different server ). The idea is to perform the encryption and decryption in two different locations using the same shared key.
Please let me know the best way to store this string value securely. I know the Keystore is not an option here because it is used for PKI.