Provider getVersion() method in Java with Examples
Last Updated :
12 Jun, 2019
The getVersion() method of java.security.Provider class is used to return the version number for this provider
Syntax:
public double getVersion()
Return Value: This method returns the version number for this provider.
Below are the examples to illustrate the getVersion() method:
Example 1:
import java.security.*;
import java.util.*;
public class GFG1 {
public static void main(String[] argv) throws Exception
{
try {
SecureRandom sr = SecureRandom.getInstance( "SHA1PRNG" );
Provider provider = sr.getProvider();
double version = provider.getVersion();
System.out.println( "version : " + version);
}
catch (NoSuchAlgorithmException e) {
System.out.println( "Exception thrown : " + e);
}
}
}
|
Example 2:
import java.security.*;
import java.util.*;
public class GFG1 {
public static void main(String[] argv) throws Exception
{
try {
KeyPairGenerator sr = KeyPairGenerator.getInstance( "DSA" , "SUN" );
Provider provider = sr.getProvider();
double version = provider.getVersion();
System.out.println( "version : " + version);
}
catch (NoSuchAlgorithmException e) {
System.out.println( "Exception thrown : " + e);
}
}
}
|
Share your thoughts in the comments
Please Login to comment...