I'm developping an Android App that generates an EC Asymetric key. When my app gets connected to a device, they exchange their public key. They then use ECDH to establish a shared secret. This shared secret is then used to derive an AES session key. All this is working fine.
I'm now working on the storage of the asymetric key. I wanted to put it in the Android KeyStore but I don't see how I can then do the ECDH operation. The key in the key store can be used to sign, decrypt or encrypt but I don't see the possibility to do ECDH operation. Is it possible?
While browsing SO, I have seen this discussion which says that it is not possible. If that's the case, how can I "secure" my asymetric key?
Thanks
ECDH is not currently supported by AndroidKeyStore as you can see here https://developer.android.com/training/articles/keystore
The alternative to store securely the key pair into the device is to use an encryption key managed by AndroidKeyStore to encrypt the EC private key.
You can use a RSA or AES key depending on your target version. See how to securely store encryption keys in android?