Java Code Examples for org.jasypt.encryption.pbe.StandardPBEByteEncryptor#setKeyObtentionIterations()

The following examples show how to use org.jasypt.encryption.pbe.StandardPBEByteEncryptor#setKeyObtentionIterations() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HibernatePBEByteEncryptor.java    From jasypt with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the key obtention iterations to be used by the internal encryptor, 
 * if a specific encryptor has not been set with <tt>setEncryptor(...)</tt>.
 * 
 * @param keyObtentionIterations to be set for the internal encryptor
 */
public void setKeyObtentionIterations(final int keyObtentionIterations) {
    if (this.encryptorSet) {
        throw new EncryptionInitializationException(
                "An encryptor has been already set: no " +
                "further configuration possible on hibernate wrapper");
    }
    final StandardPBEByteEncryptor standardPBEByteEncryptor =
        (StandardPBEByteEncryptor) this.encryptor;
    standardPBEByteEncryptor.setKeyObtentionIterations(
            keyObtentionIterations);
}
 
Example 2
Source File: HibernatePBEByteEncryptor.java    From jasypt with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the key obtention iterations to be used by the internal encryptor, 
 * if a specific encryptor has not been set with <tt>setEncryptor(...)</tt>.
 * 
 * @param keyObtentionIterations to be set for the internal encryptor
 */
public void setKeyObtentionIterations(final int keyObtentionIterations) {
    if (this.encryptorSet) {
        throw new EncryptionInitializationException(
                "An encryptor has been already set: no " +
                "further configuration possible on hibernate wrapper");
    }
    final StandardPBEByteEncryptor standardPBEByteEncryptor =
        (StandardPBEByteEncryptor) this.encryptor;
    standardPBEByteEncryptor.setKeyObtentionIterations(
            keyObtentionIterations);
}
 
Example 3
Source File: HibernatePBEByteEncryptor.java    From jasypt with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the key obtention iterations to be used by the internal encryptor, 
 * if a specific encryptor has not been set with <tt>setEncryptor(...)</tt>.
 * 
 * @param keyObtentionIterations to be set for the internal encryptor
 */
public void setKeyObtentionIterations(final int keyObtentionIterations) {
    if (this.encryptorSet) {
        throw new EncryptionInitializationException(
                "An encryptor has been already set: no " +
                "further configuration possible on hibernate wrapper");
    }
    final StandardPBEByteEncryptor standardPBEByteEncryptor =
        (StandardPBEByteEncryptor) this.encryptor;
    standardPBEByteEncryptor.setKeyObtentionIterations(
            keyObtentionIterations);
}
 
Example 4
Source File: HibernatePBEByteEncryptor.java    From jasypt with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the key obtention iterations to be used by the internal encryptor, 
 * if a specific encryptor has not been set with <tt>setEncryptor(...)</tt>.
 * 
 * @param keyObtentionIterations to be set for the internal encryptor
 */
public void setKeyObtentionIterations(final int keyObtentionIterations) {
    if (this.encryptorSet) {
        throw new EncryptionInitializationException(
                "An encryptor has been already set: no " +
                "further configuration possible on hibernate wrapper");
    }
    final StandardPBEByteEncryptor standardPBEByteEncryptor =
        (StandardPBEByteEncryptor) this.encryptor;
    standardPBEByteEncryptor.setKeyObtentionIterations(
            keyObtentionIterations);
}
 
Example 5
Source File: EncryptionConfig.java    From bearchoke with Apache License 2.0 5 votes vote down vote up
@Bean
public StandardPBEByteEncryptor standardPBEByteEncryptor() {
    StandardPBEByteEncryptor sse = new StandardPBEByteEncryptor();
    sse.setConfig(environmentStringPBEConfig());
    sse.setSaltGenerator(randomSaltGenerator());
    sse.setKeyObtentionIterations(10000);

    return sse;
}
 
Example 6
Source File: EncryptedBinaryType.java    From jasypt with Apache License 2.0 4 votes vote down vote up
private synchronized void checkInitialization() {
    
    if (!this.initialized) {
        
        if (this.useEncryptorName) {

            final HibernatePBEEncryptorRegistry registry = 
                HibernatePBEEncryptorRegistry.getInstance();
            final PBEByteEncryptor pbeEncryptor = 
                registry.getPBEByteEncryptor(this.encryptorName);
            if (pbeEncryptor == null) {
                throw new EncryptionInitializationException(
                        "No big integer encryptor registered for hibernate " +
                        "with name \"" + this.encryptorName + "\"");
            }
            this.encryptor = pbeEncryptor;
            
        } else {
            
            final StandardPBEByteEncryptor newEncryptor = 
                new StandardPBEByteEncryptor();
            
            newEncryptor.setPassword(this.password);
            
            if (this.algorithm != null) {
                newEncryptor.setAlgorithm(this.algorithm);
            }
            
            if (this.keyObtentionIterations != null) {
                newEncryptor.setKeyObtentionIterations(
                        this.keyObtentionIterations.intValue());
            }
            
            newEncryptor.initialize();
            
            this.encryptor = newEncryptor;
            
        }
        
        this.initialized = true;
    }
    
}
 
Example 7
Source File: EncryptedBinaryType.java    From jasypt with Apache License 2.0 4 votes vote down vote up
private synchronized void checkInitialization() {
    
    if (!this.initialized) {
        
        if (this.useEncryptorName) {

            final HibernatePBEEncryptorRegistry registry = 
                HibernatePBEEncryptorRegistry.getInstance();
            final PBEByteEncryptor pbeEncryptor = 
                registry.getPBEByteEncryptor(this.encryptorName);
            if (pbeEncryptor == null) {
                throw new EncryptionInitializationException(
                        "No big integer encryptor registered for hibernate " +
                        "with name \"" + this.encryptorName + "\"");
            }
            this.encryptor = pbeEncryptor;
            
        } else {
            
            final StandardPBEByteEncryptor newEncryptor = 
                new StandardPBEByteEncryptor();
            
            newEncryptor.setPassword(this.password);
            
            if (this.algorithm != null) {
                newEncryptor.setAlgorithm(this.algorithm);
            }
            
            if (this.keyObtentionIterations != null) {
                newEncryptor.setKeyObtentionIterations(
                        this.keyObtentionIterations.intValue());
            }
            
            newEncryptor.initialize();
            
            this.encryptor = newEncryptor;
            
        }
        
        this.initialized = true;
    }
    
}
 
Example 8
Source File: EncryptedBinaryType.java    From jasypt with Apache License 2.0 4 votes vote down vote up
private synchronized void checkInitialization() {
    
    if (!this.initialized) {
        
        if (this.useEncryptorName) {

            final HibernatePBEEncryptorRegistry registry = 
                HibernatePBEEncryptorRegistry.getInstance();
            final PBEByteEncryptor pbeEncryptor = 
                registry.getPBEByteEncryptor(this.encryptorName);
            if (pbeEncryptor == null) {
                throw new EncryptionInitializationException(
                        "No big integer encryptor registered for hibernate " +
                        "with name \"" + this.encryptorName + "\"");
            }
            this.encryptor = pbeEncryptor;
            
        } else {
            
            final StandardPBEByteEncryptor newEncryptor = 
                new StandardPBEByteEncryptor();
            
            newEncryptor.setPassword(this.password);
            
            if (this.algorithm != null) {
                newEncryptor.setAlgorithm(this.algorithm);
            }
            
            if (this.keyObtentionIterations != null) {
                newEncryptor.setKeyObtentionIterations(
                        this.keyObtentionIterations.intValue());
            }
            
            newEncryptor.initialize();
            
            this.encryptor = newEncryptor;
            
        }
        
        this.initialized = true;
    }
    
}
 
Example 9
Source File: EncryptedBinaryType.java    From jasypt with Apache License 2.0 4 votes vote down vote up
private synchronized void checkInitialization() {
    
    if (!this.initialized) {
        
        if (this.useEncryptorName) {

            final HibernatePBEEncryptorRegistry registry = 
                HibernatePBEEncryptorRegistry.getInstance();
            final PBEByteEncryptor pbeEncryptor = 
                registry.getPBEByteEncryptor(this.encryptorName);
            if (pbeEncryptor == null) {
                throw new EncryptionInitializationException(
                        "No big integer encryptor registered for hibernate " +
                        "with name \"" + this.encryptorName + "\"");
            }
            this.encryptor = pbeEncryptor;
            
        } else {
            
            final StandardPBEByteEncryptor newEncryptor = 
                new StandardPBEByteEncryptor();
            
            newEncryptor.setPassword(this.password);
            
            if (this.algorithm != null) {
                newEncryptor.setAlgorithm(this.algorithm);
            }
            
            if (this.keyObtentionIterations != null) {
                newEncryptor.setKeyObtentionIterations(
                        this.keyObtentionIterations.intValue());
            }
            
            newEncryptor.initialize();
            
            this.encryptor = newEncryptor;
            
        }
        
        this.initialized = true;
    }
    
}