EldoS | Feel safer!

Software components for data protection, secure storage and transfer

how to get a certificate from android key store

Also by EldoS: Solid File System
A virtual file system that offers a feature-rich storage for application documents and data with built-in compression and encryption.
#34839
Posted: 10/21/2015 05:52:08
by SAVARY AurĂ©lien (Standard support level)
Joined: 10/21/2015
Posts: 2

Hello!

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

https://www.eldos.com/forum/read.php?FID=7&TID=5526&MID=30852#message30848

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.
#34840
Posted: 10/21/2015 06:00:15
by Vsevolod Ievgiienko (EldoS Corp.)

Thank you for contacting us.

Quote
Is there a minimum level api ?

At least API level 18 is required.

The code should look this way:

Code
TElJavaCertStorage c = new TElJavaCertStorage(context);
s.getSystemStores().add("AndroidKeyStore");


You can also use TElX509Certificate.FromX509Certificate method to convert X509Certificate and PrivateKey to TElX509Certificate instance.
#34919
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:
Code
      Context context = MyApplication.getContext();
      TElJavaCertStorage certStore = new TElJavaCertStorage(context);
      certStore.getSystemStores().clear();
      certStore.getSystemStores().beginUpdate();
      certStore.getSystemStores().add("AndroidKeyStore");
      certStore.getSystemStores().endUpdate();

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

Hello.

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.

Reply

Statistics

Topic viewed 2416 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!