I have a encrypted private key string like this
-----BEGIN ENCRYPTED PRIVATE KEY-----
content
-----END ENCRYPTED PRIVATE KEY-----
I want to store the private key into my keystore file with certificate chain.
And I found that here is two functions in KeyStore.class.
KeyStore.setKeyEntry(String alias, Key key, Char[] password, Certificate[] chain)
KeyStore.setKeyEntry(String alias, byte[] key, Certificate[] chain)
What should I do in java code?
Or how to change the encrypted private key String to a java object?
Or how to change the encrypted private key String to a byte array which can be used for point 2 function?