OopsUser
OopsUser

Reputation: 4784

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,

Upvotes: 3

Views: 2994

Answers (1)

Rupert Rawnsley
Rupert Rawnsley

Reputation: 2669

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.

Upvotes: 1

Related Questions