EldoS | Feel safer!

Software components for data protection, secure storage and transfer

how to get a certificate from android key store

Also by EldoS: Rethync
The cross-platform framework that simplifies synchronizing data between mobile and desktop applications and servers and cloud storages
Posted: 10/21/2015 05:52:08
by SAVARY AurĂ©lien (Standard support level)
Joined: 10/21/2015
Posts: 2


I'm trying to get a x509 certificate from the android key store.
I have tested the code given in this post :


and tried with 'AndroidKeyStore'. But it doesn't work. Actually, certSore.getSystemStores() always returns null.

Other parts of my project using xml blackbox to generate a signature are already working, so I suppose that my license key is good.

I can also get my X509certificate using TrustManagerFactory, however it doesn't help me since I don't know if I can create a TElX509Certificate from a X509Certificate.

Is there a minimum level api ? I 'm currently using API level 18 (Android 4.3.1).

Thank you.
Posted: 10/21/2015 06:00:15
by Vsevolod Ievgiienko (EldoS Corp.)

Thank you for contacting us.

Is there a minimum level api ?

At least API level 18 is required.

The code should look this way:

TElJavaCertStorage c = new TElJavaCertStorage(context);

You can also use TElX509Certificate.FromX509Certificate method to convert X509Certificate and PrivateKey to TElX509Certificate instance.
Posted: 10/30/2015 12:04:44
by SAVARY AurĂ©lien (Standard support level)
Joined: 10/21/2015
Posts: 2

Thank you for your help.

I have tried this code:
      Context context = MyApplication.getContext();
      TElJavaCertStorage certStore = new TElJavaCertStorage(context);

      System.out.println("count: "+certStore.getCount());
But certStore count is always 0. Any idea about what I've missed?
Posted: 11/02/2015 04:51:02
by Vsevolod Ievgiienko (EldoS Corp.)


Your code is correct. I've just re-checked if TElJavaCertStorage works correctly on Android device. Looks like you simply have 0 certificates in the store.



Topic viewed 2320 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!