public String encrypt(String plaintext) { if (ecipher == null) return ""; try { byte[] ciphertext = ecipher.doFinal(plaintext.getBytes("UTF-8")); return Base64.encodeToString(ciphertext, Base64.NO_WRAP); } catch (Exception e) { Log.e("encryp", e); return ""; } }
public String rsaEncrypt(InputStream keyStream, byte[] data) { try { PublicKey pubKey = readKeyFromStream(keyStream); Cipher cipher = Cipher.getInstance("RSA/ECB/NoPadding"); cipher.init(Cipher.ENCRYPT_MODE, pubKey); byte[] cipherData = cipher.doFinal(data); return Base64.encodeToString(cipherData, Base64.NO_WRAP); } catch (Exception e) { Log.e("rsaEncrypt", e); return ""; } }
public String encrypt(String plaintext) { if (ecipher == null) return ""; try { byte[] ciphertext = ecipher.doFinal(plaintext.getBytes("UTF-8")); return Base64.encodeToString(ciphertext, Base64.NO_WRAP); } catch (Exception e) { Log.e("encryp", e); return ""; } }
public String encrypt(String plaintext) { if (ecipher == null) return ""; try { byte[] ciphertext = ecipher.doFinal(plaintext.getBytes("UTF-8")); return Base64.encodeToString(ciphertext, Base64.NO_WRAP); } catch (Exception e) { Log.e("encryp", e); return ""; } }
public String encrypt(String plaintext) { if (ecipher == null) return ""; try { byte[] ciphertext = ecipher.doFinal(plaintext.getBytes("UTF-8")); return Base64.encodeToString(ciphertext, Base64.NO_WRAP); } catch (Exception e) { Log.e("encryp", e); return ""; } }
public String encrypt(String plaintext) { if (ecipher == null) return ""; try { byte[] ciphertext = ecipher.doFinal(plaintext.getBytes("UTF-8")); return Base64.encodeToString(ciphertext, Base64.NO_WRAP); } catch (Exception e) { Log.e("encryp", e); return ""; } }
public String rsaEncrypt(InputStream keyStream, byte[] data) { try { PublicKey pubKey = readKeyFromStream(keyStream); Cipher cipher = Cipher.getInstance("RSA/ECB/NoPadding"); cipher.init(Cipher.ENCRYPT_MODE, pubKey); byte[] cipherData = cipher.doFinal(data); return Base64.encodeToString(cipherData, Base64.NO_WRAP); } catch (Exception e) { Log.e("rsaEncrypt", e); return ""; } }
public String rsaEncrypt(InputStream keyStream, byte[] data) { try { PublicKey pubKey = readKeyFromStream(keyStream); Cipher cipher = Cipher.getInstance("RSA/ECB/NoPadding"); cipher.init(Cipher.ENCRYPT_MODE, pubKey); byte[] cipherData = cipher.doFinal(data); return Base64.encodeToString(cipherData, Base64.NO_WRAP); } catch (Exception e) { Log.e("rsaEncrypt", e); return ""; } }
public String rsaEncrypt(InputStream keyStream, byte[] data) { try { PublicKey pubKey = readKeyFromStream(keyStream); Cipher cipher = Cipher.getInstance("RSA/ECB/NoPadding"); cipher.init(Cipher.ENCRYPT_MODE, pubKey); byte[] cipherData = cipher.doFinal(data); return Base64.encodeToString(cipherData, Base64.NO_WRAP); } catch (Exception e) { Log.e("rsaEncrypt", e); return ""; } }
public String rsaEncrypt(InputStream keyStream, byte[] data) { try { PublicKey pubKey = readKeyFromStream(keyStream); Cipher cipher = Cipher.getInstance("RSA/ECB/NoPadding"); cipher.init(Cipher.ENCRYPT_MODE, pubKey); byte[] cipherData = cipher.doFinal(data); return Base64.encodeToString(cipherData, Base64.NO_WRAP); } catch (Exception e) { Log.e("rsaEncrypt", e); return ""; } }