Package org.jasypt.encryption.pbe

Examples of org.jasypt.encryption.pbe.StandardPBEByteEncryptor


    /**
     * Creates a new instance of <tt>BasicBinaryEncryptor</tt>.
     */
    public BasicBinaryEncryptor() {
        super();
        this.encryptor = new StandardPBEByteEncryptor();
        this.encryptor.setAlgorithm("PBEWithMD5AndDES");
    }
View Full Code Here


    /**
     * Creates a new instance of <tt>StrongBinaryEncryptor</tt>.
     */
    public StrongBinaryEncryptor() {
        super();
        this.encryptor = new StandardPBEByteEncryptor();
        this.encryptor.setAlgorithm("PBEWithMD5AndTripleDES");
    }
View Full Code Here

        if (!config.isEncrypting()) {
            return toBytes(passwd);
        }

        //encrypt the password
        StandardPBEByteEncryptor encryptor = new StandardPBEByteEncryptor();

        char[] key = key();
        try {
            encryptor.setPasswordCharArray(key);
            return Base64.encodeBase64(encryptor.encrypt(toBytes(passwd)));
        }
        finally {
            scramble(key);
        }
    }
View Full Code Here

        if (!config.isEncrypting()) {
            return passwd;
        }

        //decrypt the password
        StandardPBEByteEncryptor encryptor = new StandardPBEByteEncryptor();
        char[] key = key();
        try {
            encryptor.setPasswordCharArray(key);
            return encryptor.decrypt(Base64.decodeBase64(passwd));
        }
        finally {
            scramble(key);
        }
View Full Code Here

    @Override
    protected CharArrayPasswordEncoder createCharEncoder() {
        byte[] password = lookupPasswordFromKeyStore();
        char[] chars = toChars(password);
       
        byteEncrypter = new StandardPBEByteEncryptor();
        byteEncrypter.setPasswordCharArray(chars);
       
        if (getProviderName()!=null && !getProviderName().isEmpty()) {
            byteEncrypter.setProviderName(getProviderName());
        }
View Full Code Here

        if (result !=null) return result;

        GeoServerSecurityManager manager = GeoServerApplication.get().getSecurityManager();
        char[] key = manager.getRandomPassworddProvider().getRandomPasswordWithDefaultLength();
       
        StandardPBEByteEncryptor enc = new StandardPBEByteEncryptor();
        enc.setPasswordCharArray(key);
        // since the password is copied, we can scramble it
        manager.disposePassword(key);
       
        if (manager.isStrongEncryptionAvailable()) {
            enc.setProvider(new BouncyCastleProvider());
            enc.setAlgorithm("PBEWITHSHA256AND128BITAES-CBC-BC");
        }
        else // US export restrictions
            enc.setAlgorithm("PBEWITHMD5ANDDES");
       
        result= new CryptImpl(enc);
        s.setAttribute(ICRYPT_ATTR_NAME, result);
        return result;
    }
View Full Code Here

            synchronized (this) {
                if (null == standardPBEByteEncryptor) {
                    if(null== password || "".equals(password)) {
                        throw new IllegalStateException("password is required");
                    }
                    StandardPBEByteEncryptor encryptor = new StandardPBEByteEncryptor();
                    encryptor.setPassword(password);
                    if (null != algorithm && !"".equals(algorithm)) {
                        encryptor.setAlgorithm(algorithm);
                    }
                    password = null;
                    standardPBEByteEncryptor = encryptor;
                }
            }
View Full Code Here

TOP

Related Classes of org.jasypt.encryption.pbe.StandardPBEByteEncryptor

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.