Package org.jasypt.exceptions

Examples of org.jasypt.exceptions.EncryptionInitializationException


     *
     * @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");
        }
        StandardPBEByteEncryptor standardPBEByteEncryptor =
            (StandardPBEByteEncryptor) this.encryptor;
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");
        }
        StandardPBEByteEncryptor standardPBEByteEncryptor =
            (StandardPBEByteEncryptor) 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");
        }
        StandardPBEByteEncryptor standardPBEByteEncryptor =
            (StandardPBEByteEncryptor) 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");
        }
        StandardPBEByteEncryptor standardPBEByteEncryptor =
            (StandardPBEByteEncryptor) this.encryptor;
View Full Code Here

     * @param message the message to be encrypted.
     * @return the encryption result.
     */
    public byte[] encrypt(byte[] 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 byte[] decrypt(byte[] 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

            this.textEncryptor = new BasicTextEncryptor();
            this.useTextEncryptor = Boolean.TRUE;
        } else {
            if (this.useTextEncryptor.booleanValue()) {
                if (this.textEncryptor == null) {
                    throw new EncryptionInitializationException(
                            "PBE Password encoder not initialized: text " +
                            "encryptor is null");
                }
            } else {
                if (this.pbeStringEncryptor == null) {
                    throw new EncryptionInitializationException(
                            "PBE Password encoder not initialized: PBE " +
                            "string encryptor is null");
                }
            }
        }
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 + "\") " +
View Full Code Here

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

            this.passwordEncryptor = new BasicPasswordEncryptor();
            this.useEncryptor = Boolean.TRUE;
        } else {
            if (this.useEncryptor.booleanValue()) {
                if (this.passwordEncryptor == null) {
                    throw new EncryptionInitializationException(
                            "Password encoder not initialized: password " +
                            "encryptor is null");
                }
            } else {
                if (this.stringDigester == null) {
                    throw new EncryptionInitializationException(
                            "Password encoder not initialized: string " +
                            "digester is null");
                }
            }
        }
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.