Category Archives: Encrypt

How to encrypt and decrypt an audio file in Android?

By | May 8, 2018

Here is a simple example to encrypt and decrypt a audio file in Android. We will directly go to the implementation part. Demo Video You can check the demo video here. Download Library You can download the simple library from here. Aim Download an audio file from internet. Encrypt and save the encrypted file in Disk, so that… Read More »

How to encrypt and decrypt a file using “AES” algorithm in Android? – Google’s Advice

By | March 19, 2013

This is a simple example showing how to encrypt and decrypt a file in android. what we will do in this post is 1. Generate a key for encrypting our data. 2. Create a file and save data using ENCRYPTION with our generated key to the SDCARD. 3. With the help of the key DECRYPT the File and… Read More »

How to encrypt a string in Android Using Base64?

By | January 9, 2012

[java] package com.coderzheaven.encryptstring; import android.annotation.SuppressLint; import android.app.Activity; import android.content.SharedPreferences; import android.os.Bundle; import android.util.Base64; @SuppressLint({ "WorldReadableFiles", "WorldWriteableFiles" }) public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); saveText("CoderzHeaven"); System.out.println(getText()); } public void saveText(String text) { SharedPreferences myPrefs = this.getSharedPreferences("myPrefs", MODE_WORLD_READABLE); SharedPreferences.Editor editor = myPrefs.edit(); text = Base64.encodeToString(text.getBytes(), Base64.DEFAULT); editor.putString("some_text", text); editor.commit(); } public String… Read More »