Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TLS/SSL client authentication using a client certificate which comes available at runtime Android/Java

Suppose I have an application which in some way retrieves a client certificate (private/public key pair) at runtime via a secure channel (so I don't have this client certificate at build time).

How can I use this client certificate for client authentication without using keytool and not using some on persistent/ondisk keystore. So I do not want (actually I can't) to import it using a command line keytool?

Actually I want to replicate the functionality done in libcurl. You just set the client certificate (with private key) and your done. It doesn't involve a keystore.

All this has to be done in Java/Android.

like image 882
Bjorn Avatar asked Mar 14 '26 19:03

Bjorn


1 Answers

You can do it in Java by defining your own KeyManager as described in the JSSE Reference Guide. I can't speak for Android.

like image 58
user207421 Avatar answered Mar 16 '26 08:03

user207421



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!