// Path: encoder/src/main/java/ru/bullyboo/encoder/constants/Constants.java
// public class Constants {
// 
//     /**
//      * Exceptions messages
//      */
//     public static final String MESSAGE_EXCEPTION = "Message was not set";
//     public static final String METHOD_EXCEPTION = "Method was not set";
//     public static final String METHOD_CFB_OFB_EXCEPTION = "Wrong method number. Set the method number between 8 and 128";
//     public static final String KEY_SIZE_EXCEPTION = "Key size can`t be equal to 0";
//     public static final String LESS_ZERO_KEY_SIZE_EXCEPTION = "Key size can`t be less than 0";
// 
//     public static final String RSA_KEY_EXCEPTION = "Wrong key size value. Set the key size between 512 and 65536";
//     public static final String RSA_KEY_MULTIPLY_EXCEPTION = "Wrong key size value. Key must be a multiple of 64";
//     public static final String RSA_KEY_CALLBACK_EXCEPTION = "Key Callback was not set";
//     public static final String RSA_HAS_NOT_KEY_EXCEPTION = "Private key was not set. Try to use privateKey() or key() methods";
//     public static final String RSA_KEY_SIZE_EXCEPTION = "Key size was not set";
// 
//     public static final String PBE_KEY_SIZE_EXCEPTION = "Key size is not valid. Key size must be: ";
// 
// }
// 
// Path: encoder/src/main/java/ru/bullyboo/encoder/methods/DESede.java
// public class DESede extends BaseMethod{
// 
//     private static final int VECTOR_LEGHT = 8;
// 
//     /**
//      * All supported methods
//      */
//     public enum Method{
//         DESEDE ("DESEDE"),
//         DESEDE_CBC_NoPadding ("DESEDE/CBC/NoPadding"),
//         DESEDE_CBC_PKCS5Padding ("DESEDE/CBC/PKCS5Padding"),
//         DESEDE_CBC_PKCS7Padding ("DESEDE/CBC/PKCS7Padding"),
//         DESEDE_CBC_ISO10126Padding ("DESEDE/CBC/ISO10126Padding");
// 
//         private final String method;
// 
//         Method(String method) {
//             this.method = method;
//         }
// 
//         public String getMethod() {
//             return method;
//         }
//     }
// 
//     /**
//      * Keysize must be equal to 128 or 192 bits.
//      * Default Keysize equals 128 bits.
//      */
//     public enum Key{
//         SIZE_128 (16),
//         SIZE_192 (24);
// 
//         private final int size;
// 
//         Key(int size) {
//             this.size = size;
//         }
//     }
// 
//     /**
//      * Implementation of DESede encryption
//      */
//     public static String encrypt(Method method, byte[] key, Key keySize, byte[] vector, byte[] message) throws Exception{
// 
// //        generate Key
//         byte[] keyBytes = generateKey(key, keySize.size);
//         SecretKeySpec keySpec = new SecretKeySpec(keyBytes, method.getMethod());
// 
// //        generate Initialization Vector
//         byte[] keyBytesIv = generateVector(vector, VECTOR_LEGHT);
//         IvParameterSpec ivSpec = new IvParameterSpec(keyBytesIv);
// 
//         Cipher cipher = Cipher.getInstance(method.getMethod());
//         cipher.init(Cipher.ENCRYPT_MODE, keySpec, ivSpec);
//         byte[] cipherText = cipher.doFinal(message);
// 
//         return Base64.encodeToString(cipherText, Base64.DEFAULT);
//     }
// 
//     /**
//      * Implementation of DESede decryption
//      */
//     public static String decrypt(Method method, byte[] key, Key keySize, byte[] vector, byte[] message) throws Exception{
// 
// //        generate Key
//         byte[] keyBytes = generateKey(key, keySize.size);
//         SecretKeySpec keySpec = new SecretKeySpec(keyBytes, method.getMethod());
// 
// //        generate Initialization Vector
//         byte[] keyBytesIv = generateVector(vector, VECTOR_LEGHT);
//         IvParameterSpec ivSpec = new IvParameterSpec(keyBytesIv);
// 
//         Cipher cipher = Cipher.getInstance(method.getMethod());
//         cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec);
//         byte[] cipherText = cipher.doFinal(Base64.decode(message, Base64.DEFAULT));
// 
//         return new String(cipherText);
//     }
// }


import ru.bullyboo.encoder.constants.Constants;
import ru.bullyboo.encoder.methods.DESede;
    public BuilderDESede key(String key) {
        this.key = key.getBytes();
        return this;
    }

    public BuilderDESede key(byte[] key, DESede.Key keySize) {
        this.key = key;
        this.keySize = keySize;
        return this;
    }

    public BuilderDESede key(byte[] key) {
        this.key = key;
        return this;
    }

    public BuilderDESede keySize(DESede.Key keySize){
        this.keySize = keySize;
        return this;
    }

    /**
     * Set initialization vector (IV)
     */
    public BuilderDESede iVector(String iVector) {
        this.iVector = iVector.getBytes();
        return this;
    }

    public BuilderDESede iVector(byte[] iVector) {
// Path: encoder/src/main/java/ru/bullyboo/encoder/constants/Constants.java
// public class Constants {
// 
//     /**
//      * Exceptions messages
//      */
//     public static final String MESSAGE_EXCEPTION = "Message was not set";
//     public static final String METHOD_EXCEPTION = "Method was not set";
//     public static final String METHOD_CFB_OFB_EXCEPTION = "Wrong method number. Set the method number between 8 and 128";
//     public static final String KEY_SIZE_EXCEPTION = "Key size can`t be equal to 0";
//     public static final String LESS_ZERO_KEY_SIZE_EXCEPTION = "Key size can`t be less than 0";
// 
//     public static final String RSA_KEY_EXCEPTION = "Wrong key size value. Set the key size between 512 and 65536";
//     public static final String RSA_KEY_MULTIPLY_EXCEPTION = "Wrong key size value. Key must be a multiple of 64";
//     public static final String RSA_KEY_CALLBACK_EXCEPTION = "Key Callback was not set";
//     public static final String RSA_HAS_NOT_KEY_EXCEPTION = "Private key was not set. Try to use privateKey() or key() methods";
//     public static final String RSA_KEY_SIZE_EXCEPTION = "Key size was not set";
// 
//     public static final String PBE_KEY_SIZE_EXCEPTION = "Key size is not valid. Key size must be: ";
// 
// }
// 
// Path: encoder/src/main/java/ru/bullyboo/encoder/methods/DESede.java
// public class DESede extends BaseMethod{
// 
//     private static final int VECTOR_LEGHT = 8;
// 
//     /**
//      * All supported methods
//      */
//     public enum Method{
//         DESEDE ("DESEDE"),
//         DESEDE_CBC_NoPadding ("DESEDE/CBC/NoPadding"),
//         DESEDE_CBC_PKCS5Padding ("DESEDE/CBC/PKCS5Padding"),
//         DESEDE_CBC_PKCS7Padding ("DESEDE/CBC/PKCS7Padding"),
//         DESEDE_CBC_ISO10126Padding ("DESEDE/CBC/ISO10126Padding");
// 
//         private final String method;
// 
//         Method(String method) {
//             this.method = method;
//         }
// 
//         public String getMethod() {
//             return method;
//         }
//     }
// 
//     /**
//      * Keysize must be equal to 128 or 192 bits.
//      * Default Keysize equals 128 bits.
//      */
//     public enum Key{
//         SIZE_128 (16),
//         SIZE_192 (24);
// 
//         private final int size;
// 
//         Key(int size) {
//             this.size = size;
//         }
//     }
// 
//     /**
//      * Implementation of DESede encryption
//      */
//     public static String encrypt(Method method, byte[] key, Key keySize, byte[] vector, byte[] message) throws Exception{
// 
// //        generate Key
//         byte[] keyBytes = generateKey(key, keySize.size);
//         SecretKeySpec keySpec = new SecretKeySpec(keyBytes, method.getMethod());
// 
// //        generate Initialization Vector
//         byte[] keyBytesIv = generateVector(vector, VECTOR_LEGHT);
//         IvParameterSpec ivSpec = new IvParameterSpec(keyBytesIv);
// 
//         Cipher cipher = Cipher.getInstance(method.getMethod());
//         cipher.init(Cipher.ENCRYPT_MODE, keySpec, ivSpec);
//         byte[] cipherText = cipher.doFinal(message);
// 
//         return Base64.encodeToString(cipherText, Base64.DEFAULT);
//     }
// 
//     /**
//      * Implementation of DESede decryption
//      */
//     public static String decrypt(Method method, byte[] key, Key keySize, byte[] vector, byte[] message) throws Exception{
// 
// //        generate Key
//         byte[] keyBytes = generateKey(key, keySize.size);
//         SecretKeySpec keySpec = new SecretKeySpec(keyBytes, method.getMethod());
// 
// //        generate Initialization Vector
//         byte[] keyBytesIv = generateVector(vector, VECTOR_LEGHT);
//         IvParameterSpec ivSpec = new IvParameterSpec(keyBytesIv);
// 
//         Cipher cipher = Cipher.getInstance(method.getMethod());
//         cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec);
//         byte[] cipherText = cipher.doFinal(Base64.decode(message, Base64.DEFAULT));
// 
//         return new String(cipherText);
//     }
// }


// Path: encoder/src/main/java/ru/bullyboo/encoder/builders/BuilderDESede.java
import ru.bullyboo.encoder.constants.Constants;
import ru.bullyboo.encoder.methods.DESede;

    public BuilderDESede key(String key) {
        this.key = key.getBytes();
        return this;
    }

    public BuilderDESede key(byte[] key, DESede.Key keySize) {
        this.key = key;
        this.keySize = keySize;
        return this;
    }

    public BuilderDESede key(byte[] key) {
        this.key = key;
        return this;
    }

    public BuilderDESede keySize(DESede.Key keySize){
        this.keySize = keySize;
        return this;
    }

    /**
     * Set initialization vector (IV)
     */
    public BuilderDESede iVector(String iVector) {
        this.iVector = iVector.getBytes();
        return this;
    }

    public BuilderDESede iVector(byte[] iVector) {
        this.iVector = iVector;