Encrypting your data
Sometimes you don't want to store any data on the sd card, but you have to, because your apps resources would take up too much space int the internal memory.
Here is a method on how to store your data securely.
Java has very easy to use built in encrypting methods, but they take up precious time.
For example a 188Kb jpg on a Nexus one would take:
Encode: 750ms
Decode 550ms
So I don't recommend using encryption on large files,
- KeyGenerator keyGenerator = KeyGenerator.getInstance("AES");
- keyGenerator.init(192);
- return keyGenerator.generateKey().getEncoded();
- }
You need to store the key in your app.
- public byte[] encript(byte[] dataToEncrypt, byte[] key)
- throws NoSuchAlgorithmException, NoSuchPaddingException,
- InvalidKeyException, IllegalBlockSizeException, BadPaddingException {
- //I'm using AES encription
- Cipher c = Cipher.getInstance("AES");
- SecretKeySpec k = new SecretKeySpec(key, "AES");
- c.init(Cipher.ENCRYPT_MODE, k);
- return c.doFinal(dataToEncrypt);
- }
- public byte[] decript(byte[] encryptedData, byte[] key)
- throws NoSuchAlgorithmException, NoSuchPaddingException,
- InvalidKeyException, IllegalBlockSizeException, BadPaddingException {
- Cipher c = Cipher.getInstance("AES");
- SecretKeySpec k = new SecretKeySpec(key, "AES");
- c.init(Cipher.DECRYPT_MODE, k);
- return c.doFinal(encryptedData);
- }
New tutorials from Helloandroid
Android on Twitter
-
@StephanieNich10 (Stephanie Nichols)#android I laughed so hard at ochocinco 's avi. Hahahaha http://t.co/MPuhhi3m
25 weeks 1 day ago -
@CarlaAtkins8 (Carla Atkins)#android Omg! This is actually f'n interesting http://t.co/JodMOehr
25 weeks 1 day ago -
@MarianMcleod12 (Marian Mcleod)#android Precisely what song is? http://t.co/YmJXU0rB
25 weeks 1 day ago -
@JoBeach15 (Jo Beach)#android haha this made me laugh, i love ted:-) http://t.co/gtcWQ79C
25 weeks 1 day ago -
@aochart3 (青ちゃ)Start playing Paradise Island on Android http://t.co/DEID0Ao5 #Android #Androidgames #Gameinsight http://t.co/e1bifSeL
25 weeks 1 day ago
Poll
Useful resources
Android Development Projects
- simple android app just convert - repost by thorapps
- Android 4pics1word Game by yhassany
- Synchronize Faceebook and Twitter feeds by mahdidarwiche
- Fake bomb for Tablet (for airsoft / paintball games) by seanchiarot
- Trading application by TravisVB
- Android App - live footy (to complete started project) by dmaco
- Worksmart mobile application by Richabhatia2
- Chess APP for Web and Mobile by johnohiggs
- androidApp - repost by mmalselek
- Nonpublic project #4532466 by folababa



