Provider 类中的 getInfo() 方法(Java)
可使用 java.security.Provider 类中的 getInfo() 方法获取供应商及其服务的易于阅读的描述。此方法无需参数,它返回供应商和服务说明。
如下所示,展示了演示该方法的程序 −
示例
import java.security.*; import java.util.*; public class Demo { public static void main(String[] argv) throws Exception { try { SecureRandom sRandom = SecureRandom.getInstance("SHA1PRNG"); Provider p = sRandom.getProvider(); System.out.println("The information is as follows:
"); System.out.println(p.getInfo()); } catch (NoSuchAlgorithmException e) { System.out.println("Error!!! NoSuchAlgorithmException"); } } }
输出
The information is as follows: 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)
广告