Guy Bieber
06/29/2020, 6:15 PM// Get the EC key generator. Has to be the OpenSSL version
val kpg: KeyPairGenerator = KeyPairGenerator.getInstance(
"EC", "AndroidOpenSSL")
val parameterSpec = ECGenParameterSpec("AndroidOpenSSL)"
//initialize and generate the keypair
kpg.initialize(parameterSpec)
val kp = kpg.generateKeyPair()
I need to be able to store and retrieve this using the android keystore, however there doesn’t seem to be a way get the self signed certificate needed to store the key pair:
val certArray : Array<Certificate> = arrayOf(certificate)
//var certPath = PublicKeyToX509Cert(keyPair.public)
keyStore.setKeyEntry(alias, keyPair.private.encoded, certArray)
Basically the first certificate in the certArray needs to be the public key certificate.
So the core question is how do I get from a publicKey to a certificate?