代码:
package tsoffice; import java.security.Provider; import java.security.Security; public class CheckJCE { public static void main(String[] args) { Provider[] providers = Security.getProviders(); for (Provider p : providers){ System.out.println("提供者名称:"+p.getName()+"版本号:"+p.getVersion()); System.out.println(); System.out.println(p.getInfo()); } System.out.println(); System.out.println(); System.out.println("支持的消息摘要名称"); for (String s:Security.getAlgorithms("messageDigest")){ System.out.println("算法名称:"+s); } System.out.println(); System.out.println(); System.out.println("支持生成公钥和私钥的方法"); for (String s : Security.getAlgorithms("keypairGenerator")){ System.out.println("name:"+s); } } }
输出结果:
提供者名称:SUN版本号:1.8 SUN (DSA key/parameter generation; DSA signing; SHA-1, MD5 digests; SecureRandom; X.509 certificates; JKS & DKS keystores; PKIX CertPathValidator; PKIX CertPathBuilder; LDAP, Collection CertStores, JavaPolicy Policy; JavaLoginConfig Configuration) 提供者名称:SunRsaSign版本号:1.8 Sun RSA signature provider 提供者名称:SunEC版本号:1.8 Sun Elliptic Curve provider (EC, ECDSA, ECDH) 提供者名称:SunJSSE版本号:1.8 Sun JSSE provider(PKCS12, SunX509/PKIX key/trust factories, SSLv3/TLSv1/TLSv1.1/TLSv1.2/TLSv1.3) 提供者名称:SunJCE版本号:1.8 SunJCE Provider (implements RSA, DES, Triple DES, AES, Blowfish, ARCFOUR, RC2, PBE, Diffie-Hellman, HMAC) 提供者名称:SunJGSS版本号:1.8 Sun (Kerberos v5, SPNEGO) 提供者名称:SunSASL版本号:1.8 Sun SASL provider(implements client mechanisms for: DIGEST-MD5, GSSAPI, EXTERNAL, PLAIN, CRAM-MD5, NTLM; server mechanisms for: DIGEST-MD5, GSSAPI, CRAM-MD5, NTLM) 提供者名称:XMLDSig版本号:1.8 XMLDSig (DOM XMLSignatureFactory; DOM KeyInfoFactory; C14N 1.0, C14N 1.1, Exclusive C14N, Base64, Enveloped, XPath, XPath2, XSLT TransformServices) 提供者名称:SunPCSC版本号:1.8 Sun PC/SC provider 提供者名称:SunMSCAPI版本号:1.8 Sun's Microsoft Crypto API provider 支持的消息摘要名称 算法名称:SHA-384 算法名称:SHA-224 算法名称:SHA-512/256 算法名称:SHA-256 算法名称:MD2 算法名称:SHA-512/224 算法名称:SHA 算法名称:SHA-512 算法名称:MD5 支持生成公钥和私钥的方法 name:RSA name:DSA name:DIFFIEHELLMAN name:RSASSA-PSS name:EC