Package org.jasypt.exceptions

Examples of org.jasypt.exceptions.EncryptionInitializationException


     *
     * @param encryptor the encryptor.
     */
    public void setEncryptor(PBEBigIntegerEncryptor encryptor) {
        if (this.encryptorSet) {
            throw new EncryptionInitializationException(
                    "An encryptor has been already set: no " +
                    "further configuration possible on hibernate wrapper");
        }
        this.encryptor = encryptor;
        this.encryptorSet = true;
View Full Code Here


     *
     * @param password the password to be set for the internal encryptor
     */
    public void setPassword(String password) {
        if (this.encryptorSet) {
            throw new EncryptionInitializationException(
                    "An encryptor has been already set: no " +
                    "further configuration possible on hibernate wrapper");
        }
        StandardPBEBigIntegerEncryptor standardPBEBigIntegerEncryptor =
            (StandardPBEBigIntegerEncryptor) this.encryptor;
View Full Code Here

     *
     * @param algorithm the algorithm to be set for the internal encryptor
     */
    public void setAlgorithm(String algorithm) {
        if (this.encryptorSet) {
            throw new EncryptionInitializationException(
                    "An encryptor has been already set: no " +
                    "further configuration possible on hibernate wrapper");
        }
        StandardPBEBigIntegerEncryptor standardPBEBigIntegerEncryptor =
            (StandardPBEBigIntegerEncryptor) this.encryptor;
View Full Code Here

           
            if ((paramAlgorithm != null) ||
                (paramPassword != null) ||
                (paramKeyObtentionIterations != null)) {
               
                throw new EncryptionInitializationException(
                        "If \"" + ParameterNaming.ENCRYPTOR_NAME +
                        "\" is specified, none of \"" +
                        ParameterNaming.ALGORITHM + "\", \"" +
                        ParameterNaming.PASSWORD + "\" or \"" +
                        ParameterNaming.KEY_OBTENTION_ITERATIONS + "\" " +
                        "can be specified");
               
            }
            this.encryptorName = paramEncryptorName;
            this.useEncryptorName = true;
           
        } else if ((paramPassword != null)) {

            this.password = paramPassword;
           
            if (paramAlgorithm != null) {
                this.algorithm = paramAlgorithm;
            }
           
            if (paramKeyObtentionIterations != null) {

                try {
                    this.keyObtentionIterations =
                        new Integer(
                                Integer.parseInt(paramKeyObtentionIterations));
                } catch (NumberFormatException e) {
                    throw new EncryptionInitializationException(
                            "Value specified for \"" +
                            ParameterNaming.KEY_OBTENTION_ITERATIONS +
                            "\" is not a valid integer");
                }
               
            }
           
        } else {
           
            throw new EncryptionInitializationException(
                    "If \"" + ParameterNaming.ENCRYPTOR_NAME +
                    "\" is not specified, then \"" +
                    ParameterNaming.PASSWORD + "\" (and optionally \"" +
                    ParameterNaming.ALGORITHM + "\" and \"" +
                    ParameterNaming.KEY_OBTENTION_ITERATIONS + "\") " +
                    "must be specified");
           
        }
       
        if (paramDecimalScale != null) {
           
            try {
                this.decimalScale =
                    new Integer(Integer.parseInt(paramDecimalScale));
            } catch (NumberFormatException e) {
                throw new EncryptionInitializationException(
                        "Value specified for \"" +
                        ParameterNaming.DECIMAL_SCALE +
                        "\" is not a valid integer");
            }
           
        } else {
           
            throw new EncryptionInitializationException(
                    ParameterNaming.DECIMAL_SCALE +
                    " must be specified");
           
        }
       
View Full Code Here

     *
     * @param keyObtentionIterations to be set for the internal encryptor
     */
    public void setKeyObtentionIterations(int keyObtentionIterations) {
        if (this.encryptorSet) {
            throw new EncryptionInitializationException(
                    "An encryptor has been already set: no " +
                    "further configuration possible on hibernate wrapper");
        }
        StandardPBEBigIntegerEncryptor standardPBEBigIntegerEncryptor =
            (StandardPBEBigIntegerEncryptor) this.encryptor;
View Full Code Here

     * @param saltGenerator the salt generator to be set for the internal
     *                      encryptor.
     */
    public void setSaltGenerator(SaltGenerator saltGenerator) {
        if (this.encryptorSet) {
            throw new EncryptionInitializationException(
                    "An encryptor has been already set: no " +
                    "further configuration possible on hibernate wrapper");
        }
        StandardPBEBigIntegerEncryptor standardPBEBigIntegerEncryptor =
            (StandardPBEBigIntegerEncryptor) this.encryptor;
View Full Code Here

     *
     * @param config the PBEConfig to be set for the internal encryptor
     */
    public void setConfig(PBEConfig config) {
        if (this.encryptorSet) {
            throw new EncryptionInitializationException(
                    "An encryptor has been already set: no " +
                    "further configuration possible on hibernate wrapper");
        }
        StandardPBEBigIntegerEncryptor standardPBEBigIntegerEncryptor =
            (StandardPBEBigIntegerEncryptor) this.encryptor;
View Full Code Here

                HibernatePBEEncryptorRegistry registry =
                    HibernatePBEEncryptorRegistry.getInstance();
                PBEBigDecimalEncryptor pbeEncryptor =
                    registry.getPBEBigDecimalEncryptor(this.encryptorName);
                if (pbeEncryptor == null) {
                    throw new EncryptionInitializationException(
                            "No big decimal encryptor registered for hibernate " +
                            "with name \"" + this.encryptorName + "\"");
                }
                this.encryptor = pbeEncryptor;
               
View Full Code Here

     * @param message the message to be encrypted.
     * @return the encryption result.
     */
    public BigInteger encrypt(BigInteger message) {
        if (this.encryptor == null) {
            throw new EncryptionInitializationException(
                    "Encryptor has not been set into Hibernate wrapper");
        }
        return this.encryptor.encrypt(message);
    }
View Full Code Here

     * @param encryptedMessage the message to be decrypted.
     * @return the result of decryption.
     */
    public BigInteger decrypt(BigInteger encryptedMessage) {
        if (this.encryptor == null) {
            throw new EncryptionInitializationException(
                    "Encryptor has not been set into Hibernate wrapper");
        }
        return this.encryptor.decrypt(encryptedMessage);
    }
View Full Code Here

TOP

Related Classes of org.jasypt.exceptions.EncryptionInitializationException

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.