Example usage for javax.crypto NoSuchPaddingException printStackTrace

List of usage examples for javax.crypto NoSuchPaddingException printStackTrace

Introduction

In this page you can find the example usage for javax.crypto NoSuchPaddingException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

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

Usage

From source file:com.tydic.dbp.utils.ThreeDesUtils.java

public static String encryptMode(String Src) {
    try {/*  ww w. j a v  a2s  .  c  o m*/
        // ?
        SecretKey deskey = new SecretKeySpec(keyBytes, Algorithm);
        // 
        Cipher c1 = Cipher.getInstance(Algorithm);
        c1.init(Cipher.ENCRYPT_MODE, deskey);
        return Hex.encodeHexString(c1.doFinal(Src.getBytes()));
    } catch (java.security.NoSuchAlgorithmException e1) {
        e1.printStackTrace();
    } catch (javax.crypto.NoSuchPaddingException e2) {
        e2.printStackTrace();
    } catch (java.lang.Exception e3) {
        e3.printStackTrace();
    }
    return null;
}

From source file:com.tydic.dbp.utils.ThreeDesUtils.java

public static String decryptMode(String srcStr) {
    try {//from   w  w w .  java2 s  .  c o  m
        // ?
        SecretKey deskey = new SecretKeySpec(keyBytes, Algorithm);
        // 
        Cipher c1 = Cipher.getInstance(Algorithm);
        c1.init(Cipher.DECRYPT_MODE, deskey);
        return new String(c1.doFinal(Hex.decodeHex(srcStr.toCharArray())));
    } catch (java.security.NoSuchAlgorithmException e1) {
        e1.printStackTrace();
    } catch (javax.crypto.NoSuchPaddingException e2) {
        e2.printStackTrace();
    } catch (java.lang.Exception e3) {
        e3.printStackTrace();
    }
    return null;
}

From source file:com.alta189.deskbin.util.DesEncrypter.java

public DesEncrypter(SecretKey key) {
    try {/*w  w  w  .j av  a 2s .co  m*/
        ecipher = Cipher.getInstance("DES");
        dcipher = Cipher.getInstance("DES");
        ecipher.init(Cipher.ENCRYPT_MODE, key);
        dcipher.init(Cipher.DECRYPT_MODE, key);

    } catch (NoSuchPaddingException e) {
        e.printStackTrace();
    } catch (NoSuchAlgorithmException e) {
        e.printStackTrace();
    } catch (InvalidKeyException e) {
        e.printStackTrace();
    }
}

From source file:corner.services.impl.DESedeEncryptServiceImpl.java

public byte[] encrypt(byte[] src, byte[] key) {
    try {/*from   w ww .  j  av  a  2  s  .  c  om*/
        SecretKey deskey = new SecretKeySpec(key, Algorithm);
        Cipher c1 = Cipher.getInstance(Algorithm);
        c1.init(Cipher.ENCRYPT_MODE, deskey);
        return c1.doFinal(src);
    } catch (java.security.NoSuchAlgorithmException e1) {
        e1.printStackTrace();
    } catch (javax.crypto.NoSuchPaddingException e2) {
        e2.printStackTrace();
    } catch (java.lang.Exception e3) {
        e3.printStackTrace();
    }
    return null;
}

From source file:corner.services.impl.DESedeEncryptServiceImpl.java

public byte[] decrypt(byte[] src, byte[] keybyte) {
    try {/*  ww w .  j  a  va2  s .c  o  m*/
        SecretKey deskey = new SecretKeySpec(keybyte, Algorithm);
        Cipher c1 = Cipher.getInstance(Algorithm);
        c1.init(Cipher.DECRYPT_MODE, deskey);
        return c1.doFinal(src);
    } catch (java.security.NoSuchAlgorithmException e1) {
        e1.printStackTrace();
    } catch (javax.crypto.NoSuchPaddingException e2) {
        e2.printStackTrace();
    } catch (java.lang.Exception e3) {
        e3.printStackTrace();
    }
    return null;
}

From source file:corner.encrypt.services.impl.DESedeEncryptServiceImpl.java

/**
 * @see corner.encrypt.services.EncryptService#encrypt(byte[], byte[])
 *//*w ww .  j a  va2 s  .  com*/
@Override
public byte[] encrypt(byte[] src, byte[] key) {
    try {
        SecretKey deskey = new SecretKeySpec(key, Algorithm);
        Cipher c1 = Cipher.getInstance(Algorithm);
        c1.init(Cipher.ENCRYPT_MODE, deskey);
        return c1.doFinal(src);
    } catch (java.security.NoSuchAlgorithmException e1) {
        e1.printStackTrace();
    } catch (javax.crypto.NoSuchPaddingException e2) {
        e2.printStackTrace();
    } catch (java.lang.Exception e3) {
        e3.printStackTrace();
    }
    return null;
}

From source file:corner.encrypt.services.impl.DESedeEncryptServiceImpl.java

/**
 * @see corner.encrypt.services.EncryptService#decrypt(byte[], byte[])
 */// w  w w.  ja  va2s  .c  om
@Override
public byte[] decrypt(byte[] src, byte[] keybyte) {
    try {
        SecretKey deskey = new SecretKeySpec(keybyte, Algorithm);
        Cipher c1 = Cipher.getInstance(Algorithm);
        c1.init(Cipher.DECRYPT_MODE, deskey);
        return c1.doFinal(src);
    } catch (java.security.NoSuchAlgorithmException e1) {
        e1.printStackTrace();
    } catch (javax.crypto.NoSuchPaddingException e2) {
        e2.printStackTrace();
    } catch (java.lang.Exception e3) {
        e3.printStackTrace();
    }
    return null;
}