When generating KeyPairs, Java expects you to pass in the Algorithm as a String:
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA");
for example. However, this code can throw an NoSuchAlgorithm or NoSuchProvider Exception if "RSA" is not a valid algorithm.
Why can't there just be an Enum with all of the algorithms to avoid dealing with this exception?
Furthermore, would it be considered bad practice to ignore this exception (in an empty catch block) as it would be impossible to get this error without modifying the string above?
Thank you for your response!