/** * Returns the encryption algorithm associated to the given JCE name. * * @param name * @param defaultValue * @return */ public static EncryptionAlgorithm forName(final String name, final EncryptionAlgorithm defaultValue) { // To be checked if ECC exists also . if ("EC".equals(name) || "ECC".equals(name)) { return ECDSA; } try { final EncryptionAlgorithm encryptionAlgorithm = valueOf(name); return encryptionAlgorithm; } catch (Exception e) { return defaultValue; } }
/** * Returns the encryption algorithm associated to the given JCE name. * * @param name * @return */ public static EncryptionAlgorithm forName(final String name) { // To be checked if ECC exists also . if ("EC".equals(name) || "ECC".equals(name)) { return ECDSA; } try { return valueOf(name); } catch (Exception e) { } throw new DSSException("Unsupported algorithm: " + name); }