I'm aware of the key wrapping and key agreement options provided by android. But what I'm trying to achieve is multiple keystores agreeing on a key, without that key ever being exposed to main memory.
Is this even possible with the current Hardware/Android APIs?
A flow would look something like this:
1. Device A generates EC keypair inside AndroidKeyStore.
2. Device B generates EC keypair inside AndroidKeyStore.
3. Device A sends pubkey to Device B and Device B send pubkey to Device A for ECDH key agreement
4. Key agreement happens inside the KeyStore, both device A and device B have a new keypair entry in their AndroidKeyStore they can use (with the same pubkey).
5. Agreed private key is never exposed to main memory, always only was agreed and stored inside the KeyStore.