// Path: common/src/main/java/org/esbtools/message/admin/common/utility/EncryptionUtility.java
// public class EncryptionUtility {
// 
//     private static final Logger LOGGER=LoggerFactory.getLogger(EncryptionUtility.class);
//     private static final String ALGORITHM = "AES/ECB/PKCS5Padding";
//     private static final String FILE_ENCODING = "UTF-8";
//     public static final String SECURITY_PROVIDER = "SunJCE";
//     private final String encryptionKey;
// 
//     public EncryptionUtility(String key) {
//         this.encryptionKey = key;
//     }
// 
//     public String encrypt(String sensitiveInfo) {
//         try {
//             Cipher cipher = Cipher.getInstance(ALGORITHM, SECURITY_PROVIDER);
//             SecretKeySpec key = new SecretKeySpec(encryptionKey.getBytes(FILE_ENCODING), "AES");
//             cipher.init(Cipher.ENCRYPT_MODE, key);
//             return Base64.encodeBase64String(cipher.doFinal(sensitiveInfo.getBytes(FILE_ENCODING)));
//         } catch(NoSuchAlgorithmException | NoSuchProviderException | NoSuchPaddingException
//                 | UnsupportedEncodingException | InvalidKeyException | IllegalBlockSizeException
//                 | BadPaddingException e) {
//             LOGGER.error("EMA Encryption error!", e);
//             return null;
//         }
//     }
// 
//     public String decrypt(String encryptedInfo) {
//         try {
//             Cipher cipher = Cipher.getInstance(ALGORITHM, SECURITY_PROVIDER);
//             SecretKeySpec key = new SecretKeySpec(encryptionKey.getBytes(FILE_ENCODING), "AES");
//             cipher.init(Cipher.DECRYPT_MODE, key);
//             return new String(cipher.doFinal(Base64.decodeBase64(encryptedInfo.getBytes(FILE_ENCODING))), FILE_ENCODING).trim();
//         } catch(NoSuchAlgorithmException | NoSuchProviderException | NoSuchPaddingException
//                 | UnsupportedEncodingException | InvalidKeyException | IllegalBlockSizeException
//                 | BadPaddingException e) {
//             LOGGER.error("EMA Decryption error!", e);
//             return null;
//         }
//     }
// 
// }


import org.esbtools.message.admin.common.utility.EncryptionUtility;
import org.junit.Assert;
import org.junit.Test;
/*
 Copyright 2015 esbtools Contributors and/or its affiliates.

 This file is part of esbtools.

 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package org.esbtools.message.admin.common;


/**
 * Unit test to demonstrate using the KeyExtractor Util
 *
 * @author ykoer
 */

public class EncryptionUtilityTest {

    @Test
    public void testEncrypter() {
// Path: common/src/main/java/org/esbtools/message/admin/common/utility/EncryptionUtility.java
// public class EncryptionUtility {
// 
//     private static final Logger LOGGER=LoggerFactory.getLogger(EncryptionUtility.class);
//     private static final String ALGORITHM = "AES/ECB/PKCS5Padding";
//     private static final String FILE_ENCODING = "UTF-8";
//     public static final String SECURITY_PROVIDER = "SunJCE";
//     private final String encryptionKey;
// 
//     public EncryptionUtility(String key) {
//         this.encryptionKey = key;
//     }
// 
//     public String encrypt(String sensitiveInfo) {
//         try {
//             Cipher cipher = Cipher.getInstance(ALGORITHM, SECURITY_PROVIDER);
//             SecretKeySpec key = new SecretKeySpec(encryptionKey.getBytes(FILE_ENCODING), "AES");
//             cipher.init(Cipher.ENCRYPT_MODE, key);
//             return Base64.encodeBase64String(cipher.doFinal(sensitiveInfo.getBytes(FILE_ENCODING)));
//         } catch(NoSuchAlgorithmException | NoSuchProviderException | NoSuchPaddingException
//                 | UnsupportedEncodingException | InvalidKeyException | IllegalBlockSizeException
//                 | BadPaddingException e) {
//             LOGGER.error("EMA Encryption error!", e);
//             return null;
//         }
//     }
// 
//     public String decrypt(String encryptedInfo) {
//         try {
//             Cipher cipher = Cipher.getInstance(ALGORITHM, SECURITY_PROVIDER);
//             SecretKeySpec key = new SecretKeySpec(encryptionKey.getBytes(FILE_ENCODING), "AES");
//             cipher.init(Cipher.DECRYPT_MODE, key);
//             return new String(cipher.doFinal(Base64.decodeBase64(encryptedInfo.getBytes(FILE_ENCODING))), FILE_ENCODING).trim();
//         } catch(NoSuchAlgorithmException | NoSuchProviderException | NoSuchPaddingException
//                 | UnsupportedEncodingException | InvalidKeyException | IllegalBlockSizeException
//                 | BadPaddingException e) {
//             LOGGER.error("EMA Decryption error!", e);
//             return null;
//         }
//     }
// 
// }


// Path: common/src/test/java/org/esbtools/message/admin/common/EncryptionUtilityTest.java
import org.esbtools.message.admin.common.utility.EncryptionUtility;
import org.junit.Assert;
import org.junit.Test;

/*
 Copyright 2015 esbtools Contributors and/or its affiliates.

 This file is part of esbtools.

 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package org.esbtools.message.admin.common;


/**
 * Unit test to demonstrate using the KeyExtractor Util
 *
 * @author ykoer
 */

public class EncryptionUtilityTest {

    @Test
    public void testEncrypter() {
        EncryptionUtility util = new EncryptionUtility("myPassisBIG12345");