Example usage for java.security InvalidAlgorithmParameterException printStackTrace

List of usage examples for java.security InvalidAlgorithmParameterException printStackTrace

Introduction

In this page you can find the example usage for java.security InvalidAlgorithmParameterException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:com.trsst.Common.java

static final KeyPair generateEncryptionKeyPair() {
    try {//w  ww  .  ja v  a 2  s. co m
        KeyPairGenerator kpg;
        // kpg = KeyPairGenerator.getInstance("EC", "BC");
        kpg = new org.bouncycastle.jcajce.provider.asymmetric.ec.KeyPairGeneratorSpi.EC();
        kpg.initialize(new ECGenParameterSpec(CURVE_NAME));
        KeyPair kp = kpg.generateKeyPair();
        return kp;
        // } catch (NoSuchAlgorithmException e) {
        // log.error("Error while generating key: " + e.getMessage(), e);
        // } catch (NoSuchProviderException e) {
        // e.printStackTrace();
    } catch (InvalidAlgorithmParameterException e) {
        e.printStackTrace();
    }
    return null;
}

From source file:com.fegor.alfresco.action.DecipherContent.java

@Override
protected void executeImpl(Action action, NodeRef actionedUponNodeRef) {
    if (nodeService.hasAspect(actionedUponNodeRef, AlfCryptoModel.ASPECT_CIPHERED)) {
        if (logger.isDebugEnabled()) {
            logger.debug(this.getClass().getName() + ": [Action for: " + actionedUponNodeRef
                    + " is deciphering...]");
        }//from  ww w  .  j  a v a2 s.  c  o  m
        if (actionedUponNodeRef != null)
            try {
                this.cryptoFileDecipher(actionedUponNodeRef);
            } catch (InvalidAlgorithmParameterException e) {
                e.printStackTrace();
            } catch (DecoderException e) {
                e.printStackTrace();
            }
    }
}

From source file:com.tcs.ebw.security.EBWSecurity.java

public byte[] encryptSymmetric(byte[] inputdata)

        throws InvalidKeyException, IllegalBlockSizeException, BadPaddingException, NoSuchPaddingException,

        NoSuchAlgorithmException {

    //EBWLogger.trace(this,"Starting method public String  encrypt(String data)");

    //EBWLogger.trace(this," data :"+new String(inputdata));

    /** Initialize cipher used for Symmetric Crypto **/

    //        cipherSymmetric = Cipher.getInstance(EBWConstants.ENCRYPTION_KEYGEN_ALGORITHM);

    //        cipherSymmetric.init(Cipher.ENCRYPT_MODE,generateKeyForSymmetric());

    try {/*  ww  w  . j av a  2s. c o  m*/

        //           cipherSymmetric = Cipher.getInstance(EBWConstants.ENCRYPTION_KEYGEN_ALGORITHM+"/CFB/NoPadding");

        System.out.println("[" + EBWConstants.ENCRYPTION_KEYGEN_ALGORITHM + "/" + EBWConstants.ENCRYPTION_MODE
                + "/" + EBWConstants.ENCRYPTION_PADDING + "]");

        cipherSymmetric = Cipher.getInstance(EBWConstants.ENCRYPTION_KEYGEN_ALGORITHM + "/"
                + EBWConstants.ENCRYPTION_MODE + "/" + EBWConstants.ENCRYPTION_PADDING);

        IvParameterSpec ivps = new IvParameterSpec(getSecretVector());

        cipherSymmetric.init(Cipher.ENCRYPT_MODE, generateKeyForSymmetric(), ivps);

    } catch (InvalidAlgorithmParameterException e) {

        // TODO Auto-generated catch block

        e.printStackTrace();

    } catch (Exception e) {

        // TODO Auto-generated catch block

        e.printStackTrace();

    }

    /**Create a byte data for encrypting.
            
            
    All inputs given to encryption are bytes.**/

    byte[] encResult = cipherSymmetric.doFinal(inputdata);

    //EBWLogger.trace(this,"Returning from method public static String  encrypt(String data)");

    return encResult;

}