Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public String decrypt(String dec) throws IOException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException {
- InputStream mybyte = new ByteArrayInputStream(dec.getBytes());
- SecretKeySpec sks = new SecretKeySpec("MyDifficultPassw".getBytes(), "AES");
- Cipher cipher = Cipher.getInstance("AES");
- cipher.init(Cipher.DECRYPT_MODE, sks);
- CipherInputStream cis = new CipherInputStream(mybyte, cipher);
- int b;
- byte[] d = new byte[8];
- String s="";
- while((b = cis.read(d)) != -1) {
- //fos.write(d, 0, b);
- s+=b;
- }
- Toast.makeText(this,s,Toast.LENGTH_LONG).show();
- cis.close();
- return s;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement