Android Keystore Type which should I choose?

I want to store protected data in a keystore. Therefore i use

KeyStore store = KeyStore.getInstance("JCEKS"); 

But Android does not seem to know "JCEKS".

 04-18 10:52:17.236: WARN/System.err(474): java.security.KeyStoreException: KeyStore JCEKS implementation not found 

Trying JKS gives the same error. Which algorithm is good to use on Android?

+6
source share
6 answers

Android seems to be using a bouncycastle provider. This is the default provider that returns api. To make sure which one is available by default on the device, use KeyStore.getDefaultType() .

In my case, it returned "BKS". There is also an exception when there is a ".". symbol on the way to the keystore.

when I stored the storage in a folder with the name of my package (as recommended in the documentation for Android), this led to an exception.

You can also check this out .

+9
source

Have you downloaded the keystore before trying to access it? The error message occurred correctly in the getInstance statement?

Some search engines say that "PKCS12" worked for a few people, let it go.

+3
source

You need a strong lock key store (BKS). Take a look here

+2
source

Use it KeyStore keyStore = KeyStore.getInstance("PKCS12");

Create a keystore with the KeyTools Explorer tool!

+2
source

This worked for me:

 KeyStore keyStore = KeyStore.getInstance("AndroidKeyStore"); 

Remember to call KeyStore.load(KeyStore.LoadStoreParameter param) before calling KeyStore.getEntry (String alias, KeyStore.ProtectionParameter param) , i.e.

 keyStore.load(null); KeyStore.Entry keyStoreEntry = keyStore.getEntry(alias, null); 
0
source

This can help:

see https://github.com/nelenkov/ecdh-kx/blob/master/src/org/nick/ecdhkx/Crypto.java

 static public void listAlgorithms( String algFilter ){ java.security.Provider[] providers = java.security.Security.getProviders(); for ( java.security.Provider p : providers ){ String providerStr = String.format( "%s/%s/%f\n", p.getName(), p.getInfo(), p.getVersion() ); mLog.debug( providerStr ); Set< Service > services = p.getServices(); List< String > algs = new ArrayList<>(); for ( Service s : services ){ boolean match = true; if ( algFilter != null ){ match = s.getAlgorithm().toLowerCase().contains( algFilter.toLowerCase() ); } if ( match ){ String algStr = String.format( "\t%s/%s/%s", s.getType(), s.getAlgorithm(), s.getClassName() ); algs.add( algStr ); } } Collections.sort( algs ); for ( String alg : algs ) mLog.debug( "\t" + alg ); mLog.debug( "" ); } }//listAlgorithms 
0
source

Source: https://habr.com/ru/post/886126/


All Articles