Wednesday, January 20, 2010

Show Java Crypto Provider

Recently I work on the project that need to use JCE library and Bouncy Castle Crypto library. After that library instation, we need to check the crypto provider that available in jre

Code as below :

import java.security.*;

class ShowCryptoProviders
{
public static void main(String []args)
{ Provider [] providers = Security.getProviders();

for(int i=0; i less than providers.length; i++)
{
System.out.println(providers[i]);
}
}
}



The console output :

SUN version 1.6
SunRsaSign version 1.7
SunJSSE version 1.6
SunJCE version 1.7
SunJGSS version 1.0
SunSASL version 1.5
XMLDSig version 1.0
SunPCSC version 1.6
BC version 1.45


These result exactly the same with /etc/java-6-openjdk/security/java.security

# List of providers and their preference orders (see above):
#
security.provider.1=sun.security.provider.Sun
security.provider.2=sun.security.rsa.SunRsaSign
security.provider.3=com.sun.net.ssl.internal.ssl.Provider
security.provider.4=com.sun.crypto.provider.SunJCE
security.provider.5=sun.security.jgss.SunProvider
security.provider.6=com.sun.security.sasl.Provider
security.provider.7=org.jcp.xml.dsig.internal.dom.XMLDSigRI
security.provider.8=sun.security.smartcardio.SunPCSC
security.provider.9=org.bouncycastle.jce.provider.BouncyCastleProvider

No comments:

Post a Comment