Java – Android Application : Managing an expired SSL certificate?

Android Application : Managing an expired SSL certificate?… here is a solution to the problem.

Android Application : Managing an expired SSL certificate?

The SSL certificate for my application’s data source has expired and they now have a new SSL certificate. When I try to execute https:// POST, this causes the debugger to get a javax.net.ssl.SSLException: Not trusted server certificate error.

How do I fix this error in my app? Do I need to redeploy to all devices?

Solution

First, you should take a look at the new certificate. What exactly changed? For example

  • Does the new certificate use the same common name (CN)?
  • Does CN match the hostname you queryed?
  • Is it signed by a different certification authority (CA)?
  • If yes, is this CA trusted by Android?

Because you lose your private application signing key, you’re basically stuck. (Everyone reading this: Always back up your keystore and store it in at least a safe place.) Otherwise, you will not be able to return. )

Are you using a third-party data source? If you are able to change the certificate to one that is trusted by Android, your application may recover. I don’t see other solutions here.

But where is your app going anyway?

With a free app, it’s not bad. Change the package name in the code and make a new application. Publish it. Use prompts in the text of your old app to inform people that the app is no longer updated and that they should get your new app.

If it’s a paid app, you’ll have a hard time finding a way to migrate your existing users.

I’m sorry to say this, because it’s a painful situation, but it must be a software engineering class you skipped. Your signature is the most important backup content. You can always redesign your code, but you don’t have any chance to use your key.

Due to the above facts as common sense, the only “official source” I can provide is this article about securing your Private key The text of the importance of

Related Problems and Solutions