Provider.Service getType() method in Java with Examples Last Updated : 19 Jan, 2023 Comments Improve Suggest changes Like Article Like Report The getType() method of java.security.Provider.Service class provides the type of the provider service. Syntax: public final String getType() Return Value: This method provides specific type of provider service. Below are the examples to illustrate the getType() method: Example 1: Java // Java program to demonstrate // getType() method import java.security.*; import java.util.*; public class GFG1 { public static void main(String[] argv) { try { // creating the object of Signature Signature sr = Signature.getInstance( "SHA1withDSA", "SUN"); // getting the Provider of the Signature sr // by using method getProvider() Provider provider = sr.getProvider(); // getting the service of the provider // using getServices() method Provider.Service service = provider .getService("Signature", sr.getAlgorithm()); // getting type of Provider.Service object // by using getType() method String name = service.getType(); // display the result System.out.println("Name of the type : " + name); } catch (NoSuchAlgorithmException e) { System.out.println("Exception thrown : " + e); } catch (NoSuchProviderException e) { System.out.println("Exception thrown : " + e); } } } Output:Name of the type : Signature Example 2: Java // Java program to demonstrate // getType() method import java.security.*; import java.util.*; public class GFG1 { public static void main(String[] argv) { try { // creating object of MessageDigest MessageDigest msd = MessageDigest.getInstance("MD5"); // getting the Provider of the Signature sr // by using method getProvider() Provider provider = msd.getProvider(); // getting the service of the provider // using getServices() method Provider.Service service = provider .getService("MessageDigest", msd.getAlgorithm()); // getting type of Provider.Service object // by using getType() method String name = service.getType(); // display the result System.out.println("Name of the type : " + name); } catch (NoSuchAlgorithmException e) { System.out.println("Exception thrown : " + e); } } } Output:Name of the type : MessageDigest Reference: https://docs.oracle.com/javase/9/docs/api/java/security/Provider.Service.html#getType-- Comment More infoAdvertise with us Next Article Provider.Service getType() method in Java with Examples rohitprasad3 Follow Improve Article Tags : Java Java-Functions Java-security package Java-Provider.Service Practice Tags : Java Similar Reads Provider.Service getProvider() method in Java with Examples The getProvider() method of java.security.Provider.Service class is used to return the provider of this provider service object. Syntax: public final Provider getProvider() Return Value: This method returns the provider of this provider service object. Below are the examples to illustrate the getPro 2 min read Provider.Service getClassName() method in Java with Examples The getClassName() method of java.security.Provider.Service class is used to return the specified name of the class utilizing its provider service. Syntax: public final String getClassName() Return Value: This method returns specified name of the class. Below are the examples to illustrate the getCl 2 min read Provider.Service getAlgorithm() method in Java with Examples The getAlgorithm() method of java.security.Provider.Service class is used to return the standard name of the algorithm this Provider.Service is associated with. Syntax: public final String getAlgorithm() Return Value: This method returns name of the algorithm. Below are the examples to illustrate th 2 min read Provider get() method in Java with Examples The get() method of java.security.Provider class is used to return the value to which the specified key is mapped, or null if this map contains no mapping for the key. More formally, if this map contains a mapping from a key k to a value v such that (key.equals(k)), then this method returns v; other 3 min read Provider getName() method in Java with Examples The getName() method of java.security.Provider class is used to return the name of this provider. Syntax: public String getName() Return Value: This method returns the name of this provider. Below are the examples to illustrate the getName() method: Example 1: Java // Java program to demonstrate // 2 min read Like