org.jasypt.encryption.pbe.StandardPBEByteEncryptor Java Examples

The following examples show how to use org.jasypt.encryption.pbe.StandardPBEByteEncryptor. 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: TestHibernateTypes.java    From jasypt with Apache License 2.0 6 votes vote down vote up
private void registerEncryptors() {
    StandardPBEStringEncryptor stringEncryptor = new StandardPBEStringEncryptor();
       stringEncryptor.setAlgorithm("PBEWithMD5AndDES");
       stringEncryptor.setPassword("jasypt-hibernate5-test");
               
       StandardPBEByteEncryptor byteEncryptor = new StandardPBEByteEncryptor();
       byteEncryptor.setAlgorithm("PBEWithMD5AndDES");
       byteEncryptor.setPassword("jasypt-hibernate5-test");
       
       StandardPBEBigIntegerEncryptor bigIntegerEncryptor = new StandardPBEBigIntegerEncryptor();
       bigIntegerEncryptor.setAlgorithm("PBEWithMD5AndDES");
       bigIntegerEncryptor.setPassword("jasypt-hibernate5-test");
       
       StandardPBEBigDecimalEncryptor bigDecimalEncryptor = new StandardPBEBigDecimalEncryptor();
       bigDecimalEncryptor.setAlgorithm("PBEWithMD5AndDES");
       bigDecimalEncryptor.setPassword("jasypt-hibernate5-test");
       
       HibernatePBEEncryptorRegistry registry =
           HibernatePBEEncryptorRegistry.getInstance();
       registry.registerPBEStringEncryptor("hibernateStringEncryptor", stringEncryptor);
       registry.registerPBEByteEncryptor("hibernateByteEncryptor", byteEncryptor);
       registry.registerPBEBigIntegerEncryptor("hibernateBigIntegerEncryptor", bigIntegerEncryptor);
       registry.registerPBEBigDecimalEncryptor("hibernateBigDecimalEncryptor", bigDecimalEncryptor);
}
 
Example #2
Source File: HibernatePBEByteEncryptor.java    From jasypt with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the password to be used by the internal encryptor, if a specific
 * encryptor has not been set with <tt>setEncryptor(...)</tt>.
 * 
 * @param password the password to be set for the internal encryptor
 */
public void setPassword(final String password) {
    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.setPassword(password);
}
 
Example #3
Source File: TestHibernateTypes.java    From jasypt with Apache License 2.0 5 votes vote down vote up
private void registerEncryptors() {
    StandardPBEStringEncryptor stringEncryptor = new StandardPBEStringEncryptor();
       stringEncryptor.setAlgorithm("PBEWithMD5AndDES");
       stringEncryptor.setPassword("jasypt-hibernate3-test");
               
       StandardPBEByteEncryptor byteEncryptor = new StandardPBEByteEncryptor();
       byteEncryptor.setAlgorithm("PBEWithMD5AndDES");
       byteEncryptor.setPassword("jasypt-hibernate3-test");
       
       HibernatePBEEncryptorRegistry registry =
           HibernatePBEEncryptorRegistry.getInstance();
       registry.registerPBEStringEncryptor("hibernateStringEncryptor", stringEncryptor);
       registry.registerPBEByteEncryptor("hibernateByteEncryptor", byteEncryptor);
}
 
Example #4
Source File: HibernatePBEByteEncryptor.java    From jasypt with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the password to be used by the internal encryptor, if a specific
 * encryptor has not been set with <tt>setEncryptor(...)</tt>.
 * 
 * @param password the password to be set for the internal encryptor
 */
public void setPassword(final String password) {
    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.setPassword(password);
}
 
Example #5
Source File: HibernatePBEByteEncryptor.java    From jasypt with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the password to be used by the internal encryptor (as a char[]), if a specific
 * encryptor has not been set with <tt>setEncryptor(...)</tt>.
 *
 * @since 1.8
 * @param password the password to be set for the internal encryptor
 */
public void setPasswordCharArray(final char[] password) {
    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.setPasswordCharArray(password);
}
 
Example #6
Source File: HibernatePBEByteEncryptor.java    From jasypt with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the algorithm to be used by the internal encryptor, if a specific
 * encryptor has not been set with <tt>setEncryptor(...)</tt>.
 * 
 * @param algorithm the algorithm to be set for the internal encryptor
 */
public void setAlgorithm(final String algorithm) {
    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.setAlgorithm(algorithm);
}
 
Example #7
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 #8
Source File: HibernatePBEByteEncryptor.java    From jasypt with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the salt generator to be used by the internal encryptor, 
 * if a specific encryptor has not been set with <tt>setEncryptor(...)</tt>.
 * 
 * @param saltGenerator the salt generator to be set for the internal
 *                      encryptor.
 */
public void setSaltGenerator(final SaltGenerator saltGenerator) {
    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.setSaltGenerator(saltGenerator);
}
 
Example #9
Source File: HibernatePBEByteEncryptor.java    From jasypt with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the PBEConfig to be used by the internal encryptor, 
 * if a specific encryptor has not been set with <tt>setEncryptor(...)</tt>.
 * 
 * @param config the PBEConfig to be set for the internal encryptor
 */
public void setConfig(final PBEConfig config) {
    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.setConfig(config);
}
 
Example #10
Source File: AES256BinaryEncryptor.java    From jasypt with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new instance of <tt>StrongBinaryEncryptor</tt>.
 */
public AES256BinaryEncryptor() {
    super();
    this.encryptor = new StandardPBEByteEncryptor();
    this.encryptor.setAlgorithm("PBEWithHMACSHA512AndAES_256");
    this.encryptor.setIvGenerator(new RandomIvGenerator());
}
 
Example #11
Source File: HibernatePBEByteEncryptor.java    From jasypt with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the password to be used by the internal encryptor (as a char[]), if a specific
 * encryptor has not been set with <tt>setEncryptor(...)</tt>.
 *
 * @since 1.8
 * @param password the password to be set for the internal encryptor
 */
public void setPasswordCharArray(final char[] password) {
    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.setPasswordCharArray(password);
}
 
Example #12
Source File: HibernatePBEByteEncryptor.java    From jasypt with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the algorithm to be used by the internal encryptor, if a specific
 * encryptor has not been set with <tt>setEncryptor(...)</tt>.
 * 
 * @param algorithm the algorithm to be set for the internal encryptor
 */
public void setAlgorithm(final String algorithm) {
    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.setAlgorithm(algorithm);
}
 
Example #13
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 #14
Source File: HibernatePBEByteEncryptor.java    From jasypt with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the salt generator to be used by the internal encryptor, 
 * if a specific encryptor has not been set with <tt>setEncryptor(...)</tt>.
 * 
 * @param saltGenerator the salt generator to be set for the internal
 *                      encryptor.
 */
public void setSaltGenerator(final SaltGenerator saltGenerator) {
    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.setSaltGenerator(saltGenerator);
}
 
Example #15
Source File: HibernatePBEByteEncryptor.java    From jasypt with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the IV generator to be used by the internal encryptor,
 * if a specific encryptor has not been set with <tt>setEncryptor(...)</tt>.
 *
 * @param ivGenerator the IV generator to be set for the internal
 *                      encryptor.
 */
public void setIvGenerator(final IvGenerator ivGenerator) {
    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.setIvGenerator(ivGenerator);
}
 
Example #16
Source File: HibernatePBEByteEncryptor.java    From jasypt with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the PBEConfig to be used by the internal encryptor, 
 * if a specific encryptor has not been set with <tt>setEncryptor(...)</tt>.
 * 
 * @param config the PBEConfig to be set for the internal encryptor
 */
public void setConfig(final PBEConfig config) {
    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.setConfig(config);
}
 
Example #17
Source File: TestHibernateTypes.java    From jasypt with Apache License 2.0 5 votes vote down vote up
private void registerEncryptors() {
    StandardPBEStringEncryptor stringEncryptor = new StandardPBEStringEncryptor();
       stringEncryptor.setAlgorithm("PBEWithMD5AndDES");
       stringEncryptor.setPassword("jasypt-hibernate3-test");
               
       StandardPBEByteEncryptor byteEncryptor = new StandardPBEByteEncryptor();
       byteEncryptor.setAlgorithm("PBEWithMD5AndDES");
       byteEncryptor.setPassword("jasypt-hibernate3-test");
       
       HibernatePBEEncryptorRegistry registry =
           HibernatePBEEncryptorRegistry.getInstance();
       registry.registerPBEStringEncryptor("hibernateStringEncryptor", stringEncryptor);
       registry.registerPBEByteEncryptor("hibernateByteEncryptor", byteEncryptor);
}
 
Example #18
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 #19
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 #20
Source File: HibernatePBEByteEncryptor.java    From jasypt with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the PBEConfig to be used by the internal encryptor, 
 * if a specific encryptor has not been set with <tt>setEncryptor(...)</tt>.
 * 
 * @param config the PBEConfig to be set for the internal encryptor
 */
public void setConfig(final PBEConfig config) {
    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.setConfig(config);
}
 
Example #21
Source File: HibernatePBEByteEncryptor.java    From jasypt with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the IV generator to be used by the internal encryptor,
 * if a specific encryptor has not been set with <tt>setEncryptor(...)</tt>.
 *
 * @param ivGenerator the IV generator to be set for the internal
 *                      encryptor.
 */
public void setIvGenerator(final IvGenerator ivGenerator) {
    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.setIvGenerator(ivGenerator);
}
 
Example #22
Source File: HibernatePBEByteEncryptor.java    From jasypt with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the salt generator to be used by the internal encryptor, 
 * if a specific encryptor has not been set with <tt>setEncryptor(...)</tt>.
 * 
 * @param saltGenerator the salt generator to be set for the internal
 *                      encryptor.
 */
public void setSaltGenerator(final SaltGenerator saltGenerator) {
    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.setSaltGenerator(saltGenerator);
}
 
Example #23
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 #24
Source File: HibernatePBEByteEncryptor.java    From jasypt with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the PBEConfig to be used by the internal encryptor, 
 * if a specific encryptor has not been set with <tt>setEncryptor(...)</tt>.
 * 
 * @param config the PBEConfig to be set for the internal encryptor
 */
public void setConfig(final PBEConfig config) {
    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.setConfig(config);
}
 
Example #25
Source File: HibernatePBEByteEncryptor.java    From jasypt with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the password to be used by the internal encryptor, if a specific
 * encryptor has not been set with <tt>setEncryptor(...)</tt>.
 * 
 * @param password the password to be set for the internal encryptor
 */
public void setPassword(final String password) {
    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.setPassword(password);
}
 
Example #26
Source File: HibernatePBEByteEncryptor.java    From jasypt with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the password to be used by the internal encryptor (as a char[]), if a specific
 * encryptor has not been set with <tt>setEncryptor(...)</tt>.
 *
 * @since 1.8
 * @param password the password to be set for the internal encryptor
 */
public void setPasswordCharArray(final char[] password) {
    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.setPasswordCharArray(password);
}
 
Example #27
Source File: HibernatePBEByteEncryptor.java    From jasypt with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the algorithm to be used by the internal encryptor, if a specific
 * encryptor has not been set with <tt>setEncryptor(...)</tt>.
 * 
 * @param algorithm the algorithm to be set for the internal encryptor
 */
public void setAlgorithm(final String algorithm) {
    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.setAlgorithm(algorithm);
}
 
Example #28
Source File: HibernatePBEByteEncryptor.java    From jasypt with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the salt generator to be used by the internal encryptor, 
 * if a specific encryptor has not been set with <tt>setEncryptor(...)</tt>.
 * 
 * @param saltGenerator the salt generator to be set for the internal
 *                      encryptor.
 */
public void setSaltGenerator(final SaltGenerator saltGenerator) {
    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.setSaltGenerator(saltGenerator);
}
 
Example #29
Source File: HibernatePBEByteEncryptor.java    From jasypt with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the algorithm to be used by the internal encryptor, if a specific
 * encryptor has not been set with <tt>setEncryptor(...)</tt>.
 * 
 * @param algorithm the algorithm to be set for the internal encryptor
 */
public void setAlgorithm(final String algorithm) {
    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.setAlgorithm(algorithm);
}
 
Example #30
Source File: HibernatePBEByteEncryptor.java    From jasypt with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the password to be used by the internal encryptor (as a char[]), if a specific
 * encryptor has not been set with <tt>setEncryptor(...)</tt>.
 *
 * @since 1.8
 * @param password the password to be set for the internal encryptor
 */
public void setPasswordCharArray(final char[] password) {
    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.setPasswordCharArray(password);
}