Package org.sf.bee.commons.cryptograph

Examples of org.sf.bee.commons.cryptograph.BeeDesEncrypter


        return new BasicDBObject();
    }

    private String encrypt(final String value) {
        if (_encoded) {
            final BeeDesEncrypter encrypter = new BeeDesEncrypter(SECRET);
            final String result = encrypter.encrypt(value);
            return result;
        }
        return value;
    }
View Full Code Here


        return value;
    }

    private String decrypt(final String value) {
        if (_encoded) {
            final BeeDesEncrypter encrypter = new BeeDesEncrypter(SECRET);
            final byte[] data = encrypter.decrypt(value);
            return null != data && data.length > 0 ? new String(data) : "{}";
        }
        return null != value ? value : "{}";
    }
View Full Code Here

        return null;
    }

    private String encrypt(final byte[] data, final String secret) {
        if(StringUtils.hasText(secret)){
            final BeeDesEncrypter chipher = new BeeDesEncrypter(secret);
            return chipher.encrypt(data);
        } else {
            return BeeBase64.encodeBytes(data);
        }
    }
View Full Code Here

    private byte[] decrypt(final byte[] data, final String secret)
            throws UnsupportedEncodingException {
        final String sdata = new String(data, "UTF8");
        if(StringUtils.hasText(secret)){
            final BeeDesEncrypter chipher = new BeeDesEncrypter(secret);
            return chipher.decrypt(sdata);
        } else {
            return BeeBase64.decode(sdata);
        }
    }
View Full Code Here

TOP

Related Classes of org.sf.bee.commons.cryptograph.BeeDesEncrypter

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.