MessageDigest getProvider() method in Java with Examples Last Updated : 19 Jan, 2023 Summarize Comments Improve Suggest changes Share Like Article Like Report The method getProvider() of java.security.MessageDigest class is used to get the provider of this message digest. Syntax: public final Provider getProvider() Return Value: This method returns the provider of this MessageDigest. Below are the examples to illustrate the getProvider() method: Example 1: For AlgorithmMD5 Java // Java program to demonstrate // getProvider() 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 provider used in object msd // using getProvider() method Provider pro = msd.getProvider(); // display the provider System.out.println("Provider : " + pro); } catch (NoSuchAlgorithmException e) { System.out.println("Exception thrown : " + e); } catch (ProviderException e) { System.out.println("Exception thrown : " + e); } } } Output:Provider : SUN version 1.8 Example 2: For Algorithm SHA-256 Java // Java program to demonstrate // getProvider() 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("SHA-256"); // getting provider used in object msd // using getProvider() method Provider pro = msd.getProvider(); // display the provider System.out.println("Provider : " + pro); } catch (NoSuchAlgorithmException e) { System.out.println("Exception thrown : " + e); } catch (ProviderException e) { System.out.println("Exception thrown : " + e); } } } Output:Provider : SUN version 1.8 Reference: https://docs.oracle.com/javase/9/docs/api/java/security/MessageDigest.html#getAlgorithm-- Comment More infoAdvertise with us Next Article MessageDigest getProvider() method in Java with Examples R rohitprasad3 Follow Improve Article Tags : Java Java-Functions Java-security package Java-MessageDigest Practice Tags : Java Similar Reads MessageDigest getInstance() method in Java with Examples getInstance(String algorithm) The getInstance() method of java.security.MessageDigest class used to return a object of MessageDigest type that applies the assigned MessageDigest algorithm. Syntax: public static MessageDigest getInstance(String algorithm) throws NoSuchAlgorithmException Parameters: T 4 min read MessageDigest getAlgorithm() method in Java with Examples The method getAlgorithm() of java.security.MessageDigest class is used to return the standard name of the algorithm this message digest is associated with. Syntax: public final String getAlgorithm() Return Value: This method returns the algorithm used in message digest. Below are the examples to ill 2 min read KeyPairGenerator getProvider() method in Java with Examples The getProvider() method of java.security.KeyPairGenerator class is used to return the provider of this key pair generator object. Syntax: public final Provider getProvider() Return Value: This method returns the provider of this key pair generator object. Below are the examples to illustrate the ge 2 min read KeyStore getProvider() method in Java with Examples The getProvider() method of java.security.KeyStore class is used to get the Provider associated with this KeyStore instance. Syntax: public final Provider getProvider() Parameter: This method accepts nothing as a parameter. Return Value: This method returns the Provider associated with this KeyStore 3 min read KeyFactory getProvider() method in Java with Examples The getProvider() method of java.security.KeyFactory class is used to get the name of the Provider's object used by this KeyFactory instance. Syntax: public final Provider getProvider() Parameters: This method does not takes any parameters. Return Value: This method returns the name of the Provider' 2 min read Like