Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing client certificate on android programmatically without dialog?

I'm trying to install client certificate on android programmatically, using the following code :

Intent clientCertInstall = KeyChain.createInstallIntent();
clientCertInstall.putExtra(KeyChain.EXTRA_PKCS12, clientCert);
clientCertInstall.putExtra(KeyChain.EXTRA_NAME, "Client Cert");
MyActivity.this.startActivityForResult(clientCertInstall, REGISTER_CLIENT_CERT);

When the installation activity launches, android requests the user to enter password for the certificate (although there is no password and just clicking ok works)

enter image description here

More over, after clicking OK the user is requested by android to enter a name for the certificate, although i gave him a name in the "KeyChain.EXTRA_NAME" parameter.

enter image description here

This behavior annoys my users, they don't understand about certificates and just want it to be installed automatically without dialogs, how can i achieve this ? avoiding even one dialog would be very helpful.

Thanks,

like image 713
OopsUser Avatar asked Aug 01 '26 10:08

OopsUser


1 Answers

This is "by design". Allowing apps to install certificates without user approval would open up the possibility of man-in-the-middle attacks on SSL-secured communication channels, such as online banking. That said, the dialog tells you none of this and users would undoubtably press OK regardless of what it said.

like image 130
Rupert Rawnsley Avatar answered Aug 02 '26 22:08

Rupert Rawnsley



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!