Provider getInfo() method in Java


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

Samual Sam
Samual Sam

Learning faster. Every day.

Updated on: 30-Jul-2019

368 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements