The problem is in the 4th from bottom line of code:
System.out.println((noSuchProvdr.getMessage());
^
Remove the extra parenthesis from there to make it
System.out.println(noSuchProvdr.getMessage());
Edit: If the compiler is telling you java.security.NoSuchProviderException is never thrown in body of corresponding try statement
, remove this last catch
block
catch (NoSuchProviderException noSuchProvdr) {
System.out.println((noSuchProvdr.getMessage());
}
3
solved Making RSA keys in Java [closed]