Provider getInfo() method in Java

Java 8ProgrammingObject Oriented Programming

An easily readable description of the provider and its services can be obtained using the method getInfo() in the class java.security.Provider. This method requires no parameters and it returns a provider and services description.

A program that demonstrates this is given as follows −

Example

 Live Demo

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");
      }
   }
}

Output

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)
raja
Published on 12-Mar-2019 12:15:15
Advertisements