package com.mindprod.example;
import java.security.Provider;
import java.security.Security;
import static java.lang.System.*;
/**
* List all supported formats of the Keystore File,.
* <p/>
* i.e. Supported KeyStore providers.
* e.g.
* JKS
* CaseExactJKS
* JKS
* PKCS12
* JCEKS
* Windows-ROOT
* Windows-MY
*
* @author Roedy Green, Canadian Mind Products
* @version 1.0 2008-04-20 ased on code from http://exampledepot.com/egs/java.security/ListServices.html
* @since 2008-04-20
*/
public class ShowKeyStoreProviders
{
/**
* Get list of Keystore providers supported.
*
* @param args not used
*/
public static void main( String[] args )
{
final String serviceTypeOfInterest = "KeyStore";
final Provider[] providers = Security.getProviders();
for ( Provider provider : providers )
{
for ( Object okey : provider.keySet() )
{
final String key = ( ( String ) okey ).split( " " )[ 0 ];
if ( key.startsWith( serviceTypeOfInterest + "." ) )
{
out.println( key.substring( serviceTypeOfInterest.length() + 1 ) );
}
}
}
}
}