getinstance java

Solutions on MaxInterview for getinstance java by the best coders in the world

showing results for - "getinstance java"
Sohan
28 Jan 2019
1import java.security.*;
2import java.util.*;
3 
4public class GFG1 {
5    public static void main(String[] argv)
6    {
7        try {
8            // creating the object of Signature and getting instance
9            // By using getInstance() method
10            Signature sr = Signature.getInstance("SHA1WithRSA");
11 
12            // getting the status of signature object
13            String str = sr.toString();
14 
15            // printing the status
16            System.out.println("Status : " + str);
17        }
18 
19        catch (NoSuchAlgorithmException e) {
20 
21            System.out.println("Exception thrown : " + e);
22        }
23        catch (ProviderException e) {
24 
25            System.out.println("Exception thrown : " + e);
26        }
27    }
28}