Package org.rat.free.security.makifx.common.exception

Examples of org.rat.free.security.makifx.common.exception.BaseApplicationException


            return ksd;

        } catch (Exception exc) {
            System.err.println("Exception -decrypt- EXC: " + exc);
            exc.printStackTrace();
            throw new BaseApplicationException("Decrypt Error!").setException(exc);
        } finally {
            try {
                if (sr != null) {
                    sr.close();
                }
View Full Code Here


        /**
         * Se l'istanza del message digest, hash usato per mapping, e' nulla
         * allora si e' verificato un errore fatale.
         */
        if (message_digest == null) {
            throw new BaseApplicationException(
                    "Fatal Error, no such algorithm for message digest.")
                    .setErrorType(BaseApplicationException.ErrorType.FATAL);
        }

        try {

            // Per ovviare a differinti platform decodifico in UTF-8
            byte[] b_password = passwd;

            // Uso hash per tagliare i bytes AES (16 bytes)
            b_password = message_digest.digest(b_password);

            System.arraycopy(b_password, 0, b_password, 0, DEFAULT_AES_DIV_SIZE);
            SecretKeySpec sks = new SecretKeySpec(b_password, DEFAULT_ALGORITHM_CRY);

            return sks;

        } catch (Exception exc) {
            throw new BaseApplicationException(
                    "Fatal Error, impossible to generate key.\n"
                    + "Please check your Java installation.")
                    .setErrorType(BaseApplicationException.ErrorType.FATAL)
                    .setException(exc);
        }
View Full Code Here

            enc = __result;

            return enc;

        } catch (Exception exc) {
            throw new BaseApplicationException(
                    "Warning, can't encrypt data ")
                    .setErrorType(BaseApplicationException.ErrorType.WARNING)
                    .setException(exc);
        } finally {
            key = null;
View Full Code Here

            decvalue = c.doFinal(__enc_value);

            return decvalue;

        } catch (Exception exc) {
            throw new BaseApplicationException(
                    "Warning, can't decrypt data ")
                    .setErrorType(BaseApplicationException.ErrorType.WARNING)
                    .setException(exc);
        }
    }
View Full Code Here

            SecretKeySpec sks = new SecretKeySpec(b_password, DEFAULT_ALGORITHM_CRY);

            return sks;

        } catch (Exception exc) {
            throw new BaseApplicationException(
                    "Fatal Error, impossible to generate key.\n"
                    + "Please check your Java installation.")
                    .setErrorType(BaseApplicationException.ErrorType.FATAL)
                    .setException(exc);
        }
View Full Code Here

             *
             */
            return concatenateByte(arr_salt, concatenateByte(arr_iv, enc));

        } catch (Exception exc) {
            throw new BaseApplicationException(
                    "Warning, can't encrypt data ")
                    .setErrorType(BaseApplicationException.ErrorType.WARNING)
                    .setException(exc);
        } finally {
            key = null;
View Full Code Here

            SecretKey key = createNewSecretKey(pass_value);
            IvParameterSpec ivp = new IvParameterSpec(iv);
            c.init(Cipher.DECRYPT_MODE, key, ivp);
            return c.doFinal(enc);
        } catch (Exception exc) {
            throw new BaseApplicationException(
                    "Warning, can't decrypt data ")
                    .setErrorType(BaseApplicationException.ErrorType.WARNING)
                    .setException(exc);
        }
    }
View Full Code Here

            m.setProperty(Marshaller.JAXB_ENCODING, DEFAULT_CHARSET);
            str_writer = new StringWriter();
            m.marshal(this, str_writer);
            return str_writer;
        } catch (Exception exc) {
            throw new BaseApplicationException(
                    "Marshal Error")
                    .setException(exc)
                    .setErrorType(BaseApplicationException.ErrorType.FATAL);
        } finally {
            if (str_writer != null) {
View Full Code Here

            JAXBContext jaxb_context = JAXBContext.newInstance(clazz);
            Unmarshaller um = jaxb_context.createUnmarshaller();
            T t = (T) um.unmarshal(r = new StringReader(ris));
            result = UnmarshaledObject.Create.instance(t, ris, mode);
        } catch (Exception exc) {
            throw new BaseApplicationException("Decrypt Error!").setException(exc);
        } finally {
            try {
                if (r != null) {
                    r.close();
                }
View Full Code Here

    }

    protected void checkDeclaredAnnotationsByType(@Nonnull final Class class_value) throws BaseApplicationException {
        Annotation[] anno = class_value.getDeclaredAnnotationsByType(Stockable.class);
        if (anno == null || anno.length == 0) {
            throw new BaseApplicationException("Can't find annotation to manage classes on " + class_value.getCanonicalName());
        }
    }
View Full Code Here

TOP

Related Classes of org.rat.free.security.makifx.common.exception.BaseApplicationException

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.