i want to store AES key in AndroidKeyStore on pre-M device
i tried to use key generated with KeyGenerator
KeyGenerator keyGen = KeyGenerator.getInstance(KeyProperties.KEY_ALGORITHM_AES);
keyGen.init(256);
SecretKey secretKey = keyGen.generateKey();
but i cannot access to that key from KeyStore, later i tried to use KeyPairGenerator
KeyPairGenerator kpg = KeyPairGenerator.getInstance(
KeyProperties.KEY_ALGORITHM_AES, "AndroidKeyStore");
kpg.initialize(new KeyPairGeneratorSpec.Builder(this)
.setAlias("alias")
.build());
KeyPair kp = kpg.genKeyPair();
but
java.security.NoSuchAlgorithmException: KeyPairGenerator AES implementation not found