Guest User

Untitled

a guest
Jul 17th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. byte[] decodedPrivateKey = Base64.decode(savedText1,0);
  2. PKCS8EncodedKeySpec X509privbKey = new PKCS8EncodedKeySpec(decodedPrivateKey);
  3. privKey = KeyFactory.getInstance("RSA").generatePrivate(X509privbKey);
  4. editText.setText(privKey.toString());
  5.  
  6. //byte[] bytes2 = cipher2.doFinal(txt.getBytes("UTF-8"));
  7. byte [] decodedMess = Base64.decode(productObject.getString("data"), 0);
  8. Cipher decript2 = Cipher.getInstance("RSA");
  9. decript2.init(Cipher.DECRYPT_MODE,privKey);
  10. byte[] decriptedBytes2 = decript2.doFinal(decodedMess);
  11. String s =new String(decriptedBytes2, "UTF-8");
  12.  
  13. Toast toast = Toast.makeText(getApplicationContext(), s.toString(), Toast.LENGTH_SHORT);
  14. toast.show();
Add Comment
Please, Sign In to add comment