public static Transformation parse()

in src/main/java/org/apache/commons/crypto/utils/Transformation.java [43:58]


    public static Transformation parse(final String transformation) throws NoSuchAlgorithmException, NoSuchPaddingException {
        if (transformation == null) {
            throw new NoSuchAlgorithmException("No transformation given.");
        }

        //
        // Array containing the components of a Cipher transformation: index 0:
        // algorithm (e.g., AES) index 1: mode (e.g., CTR) index 2: padding (e.g.,
        // NoPadding)
        //
        final String[] parts = transformation.split(T_DELIM_REGEX, T_DELIM_PARTS + 1);
        if (parts.length != T_DELIM_PARTS) {
            throw new NoSuchAlgorithmException("Invalid transformation format: " + transformation);
        }
        return new Transformation(parts[0], parts[1], parts[2]);
    }