throw new NoSuchAlgorithmException(e.toString()); } catch (InvalidAlgorithmParameterException e) {
throw new NoSuchAlgorithmException(e.toString()); } catch (InvalidAlgorithmParameterException e) {
throw new NoSuchAlgorithmException(e.toString()); } catch (InvalidAlgorithmParameterException e) {
throw new NoSuchAlgorithmException(e.toString()); } catch (InvalidAlgorithmParameterException e) {
throw new NoSuchAlgorithmException(e.toString()); } catch (InvalidAlgorithmParameterException e) {
throw new NoSuchAlgorithmException(e.toString()); } catch (InvalidAlgorithmParameterException e) {
throw new NoSuchAlgorithmException(e.toString()); } catch (InvalidAlgorithmParameterException e) {
throw new NoSuchAlgorithmException(e.toString()); } catch (InvalidAlgorithmParameterException e) {
throw new NoSuchAlgorithmException(e.toString()); } catch (InvalidAlgorithmParameterException e) {
throw new NoSuchAlgorithmException(e.toString()); } catch (InvalidAlgorithmParameterException e) {
throw new NoSuchAlgorithmException(e.toString()); } catch (InvalidAlgorithmParameterException e) {
throw new NoSuchAlgorithmException(e.toString()); } catch (InvalidAlgorithmParameterException e) {
throw new NoSuchAlgorithmException(e.toString()); } catch (InvalidAlgorithmParameterException e) {
throw new NoSuchAlgorithmException(e.toString()); } catch (InvalidAlgorithmParameterException e) {
throw new NoSuchAlgorithmException(e.toString());
throw new NoSuchAlgorithmException(e.toString());
public String encrypt(String input) throws PubNubException { try { initCiphers(); AlgorithmParameterSpec ivSpec = new IvParameterSpec(ivBytes); SecretKeySpec newKey = new SecretKeySpec(keyBytes, "AES"); Cipher cipher = null; cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); cipher.init(Cipher.ENCRYPT_MODE, newKey, ivSpec); return new String(Base64.encode(cipher.doFinal(input.getBytes("UTF-8")), 0), Charset.forName("UTF-8")); } catch (NoSuchAlgorithmException e) { throw PubNubException.builder().errormsg(e.toString()).build(); } catch (NoSuchPaddingException e) { throw PubNubException.builder().errormsg(e.toString()).build(); } catch (InvalidKeyException e) { throw PubNubException.builder().errormsg(e.toString()).build(); } catch (InvalidAlgorithmParameterException e) { throw PubNubException.builder().errormsg(e.toString()).build(); } catch (UnsupportedEncodingException e) { throw PubNubException.builder().errormsg(e.toString()).build(); } catch (IllegalBlockSizeException e) { throw PubNubException.builder().errormsg(e.toString()).build(); } catch (BadPaddingException e) { throw PubNubException.builder().errormsg(e.toString()).build(); } }
public String encrypt(String input) throws PubNubException { try { initCiphers(); AlgorithmParameterSpec ivSpec = new IvParameterSpec(ivBytes); SecretKeySpec newKey = new SecretKeySpec(keyBytes, "AES"); Cipher cipher = null; cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); cipher.init(Cipher.ENCRYPT_MODE, newKey, ivSpec); return new String(Base64.encode(cipher.doFinal(input.getBytes("UTF-8")), 0), Charset.forName("UTF-8")); } catch (NoSuchAlgorithmException e) { throw PubNubException.builder().errormsg(e.toString()).build(); } catch (NoSuchPaddingException e) { throw PubNubException.builder().errormsg(e.toString()).build(); } catch (InvalidKeyException e) { throw PubNubException.builder().errormsg(e.toString()).build(); } catch (InvalidAlgorithmParameterException e) { throw PubNubException.builder().errormsg(e.toString()).build(); } catch (UnsupportedEncodingException e) { throw PubNubException.builder().errormsg(e.toString()).build(); } catch (IllegalBlockSizeException e) { throw PubNubException.builder().errormsg(e.toString()).build(); } catch (BadPaddingException e) { throw PubNubException.builder().errormsg(e.toString()).build(); } }