![](/img/trans.png)
[英]How can I use an X.509 certificate with private key from the android keychain in C#/Xamarin?
[英]I want to use Android KeyChain to store public key and private key
我想将私钥存储在 android KeyChain 中。 我已经编写代码来存储密钥。 但我不明白卸载应用程序并清除应用程序密钥是否丢失。 当清除应用程序或卸载密钥仍然存在时,我想将密钥存储在 KeyChain 中。
try {
Intent intent = KeyChain.createInstallIntent();
intent.putExtra("PKEY", privateKey);
intent.putExtra("KEY", publicKey);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
return true;
} catch (ActivityNotFoundException e) {
Log.w("MainActivity", "could not store key pair: " + e);
}
如何从 KeyChain.createInstallIntent() 中检索私钥?
Intent stores data for only for some limited time.If you want to store key value data permanently I suggest to use Json Api.You have to create json API using PHP & manage your data by calling APi when you need in your android App.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.