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

Examples of com.alibaba.otter.node.etl.common.io.signature.ChecksumException


    public static byte[] decrypt(EncryptedData encode) {
        String destCrc = ChecksumUtils.checksum(encode.getData());
        //验证sign
        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());
View Full Code Here


            // 读取key内容
            byte[] keyBytes = new byte[keyLength];
            raf.read(keyBytes, 0, keyLength);
            String keystr = ByteUtils.bytesToString(keyBytes);
            if (!key.equals(keystr)) {
                throw new ChecksumException("unmatch garble key with[" + key + "],[" + keystr + "]");
            }

            // 读取校验码长度
            raf.seek(pos + keyLength);
            byte[] crcBytes = new byte[crcLength];
            raf.read(crcBytes, 0, crcLength);
            String crcStr = ByteUtils.bytesToString(crcBytes);
            if (!crc.equals(crcStr)) {
                throw new ChecksumException("unmatch crc with[" + crc + "],[" + crcStr + "]");
            }

            // 设置文件长度
            raf.setLength(pos);
        } catch (Exception e) {
View Full Code Here

TOP

Related Classes of com.alibaba.otter.node.etl.common.io.signature.ChecksumException

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.