code: private byte[] doCipher(byte[] input, int mode) throws
              DecoderException, InvalidKeyException, InvalidAlgorithmParameterException,
              IllegalBlockSizeException, BadPaddingException, EncoderException
      {
          if (input == null)
          {
              return null;
          }
  
          if (cipher == null)
          {
              throw new IllegalStateException("setCipher() has not been called.");
          }
  
          if (key == null && certificate == null)
          {
              throw new IllegalStateException("setInit() has not been called.");
          }
  
          if (mode == Cipher.DECRYPT_MODE)
          {
              input = decode(input);
          }
  
          initCipher(mode);
  
          byte[] output = cipher.doFinal(input);
  
          if (mode == Cipher.ENCRYPT_MODE)
          {
              output = encode(output);
          }
  
          return output;
      }
docs: Encrypt or decrypt.