Java中的提供者getInfo()方法

使用getInfo()类java.security.Provider中的方法可以获得提供者及其服务的易于理解的描述。此方法不需要任何参数,它返回提供程序和服务描述。

演示此的程序如下所示-

示例

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:\n");
         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)