Package com.alibaba.otter.node.etl.common.io.crypto

Examples of com.alibaba.otter.node.etl.common.io.crypto.AESUtils


public class AESUtilsTest extends BaseOtterTest {

    @Test
    public void test_simple() {
        AESUtils aes = new AESUtils();
        aes.generateSecretKey();
        byte[] data = getBlock(10 * 1024);
        byte[] encrypt = aes.encrypt(data);
        byte[] decrypt = aes.decrypt(encrypt);
        System.out.println("data length : " + data.length + " " + encrypt.length);
        check(data, decrypt);
    }
View Full Code Here


    public static EncryptedData encrypt(byte[] input) {
        // 压缩数据
        byte[] compData = COMPRESSOR.compress(input);

        // 调用加密工具类
        AESUtils aes = new AESUtils();
        aes.generateSecretKey();

        // 加密数据
        byte[] encryptData = aes.encrypt(compData);
        return new EncryptedData(encryptData, aes.getSecretyKeyString(), ChecksumUtils.checksum(encryptData));
    }
View Full Code Here

        if (false == StringUtils.equals(encode.getCrc(), destCrc)) {
            throw new ChecksumException(String.format("orig: %s, parsed: %s not match", encode.getCrc(), destCrc));
        }

        // 调用加密工具类
        AESUtils aes = new AESUtils();
        aes.setSecretKeyString(encode.getKey());
        // 解密并解压数据
        return COMPRESSOR.decompress(aes.decrypt(encode.getData()));
    }
View Full Code Here

TOP

Related Classes of com.alibaba.otter.node.etl.common.io.crypto.AESUtils

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.