FULL Guide to Encryption & Decryption in Android (Keystore, Ciphers and more)

  Рет қаралды 70,758

Philipp Lackner

Philipp Lackner

Күн бұрын

Пікірлер: 139
@snehilsinha5624
@snehilsinha5624 2 жыл бұрын
How's it possible that whenever I work with something new in my internship at my company and wonder what's this... You come up with a detailed video on that one !! 😱. Philipp Op
@PhilippLackner
@PhilippLackner 2 жыл бұрын
I secretly listen to your conversations
@snehilsinha5624
@snehilsinha5624 2 жыл бұрын
@@PhilippLackner ouu 😶. I'll encrypt my conversations in keystore from the next time onwards 🌚.
@RickertBrandsen
@RickertBrandsen 2 жыл бұрын
@@snehilsinha5624 lol, from that point onwards, you will no longer have videos u need :( :D
@snehilsinha5624
@snehilsinha5624 2 жыл бұрын
@@RickertBrandsen 🥲
@sreerajvijayan3072
@sreerajvijayan3072 2 жыл бұрын
I face the same situation 😃
@oguzhanyldrm6798
@oguzhanyldrm6798 Жыл бұрын
I've used EncryptedSharedPref on my projects and was wondering to create a Security Class like this to use KeyStore on regular files. This is a complete & well explained guide for that. Thanks for sharing your knowledge with community Philipp.
@generalroboskel
@generalroboskel 2 жыл бұрын
Damn... you're seriously carrying the flag for Android development advocacy. Much props! Keep going. You should be working for Google haha. (but I'm sure your aspirations are much bigger)
@PhilippLackner
@PhilippLackner 2 жыл бұрын
Haha thank you, but in regards to Google I'll pass
@baijusharma6027
@baijusharma6027 2 жыл бұрын
There are so many things you teach us. You are truly a Hero for us. 🎉
@iamlegend1489
@iamlegend1489 2 жыл бұрын
Hey Philipp, u r getting more likes within 7mins for a 27mins video. U r dng a good job man!
@PhilippLackner
@PhilippLackner 2 жыл бұрын
Thank you!
@rishabhjain1902
@rishabhjain1902 2 жыл бұрын
It would be great if you use the images or a short presentation slides or animation for better understanding. This is still the best channel out there .
@PhilippLackner
@PhilippLackner 2 жыл бұрын
Then I could probably only upload once a week or less frequently. Still interested? I think most people would pick 2 videos a week instead at 90% quality than one video at 100
@shubhamshinde4042
@shubhamshinde4042 2 жыл бұрын
Thank you very very much Phillip, your videos help us alot, your contribution is very very valuable to us. Keep inspiring the android dev community 🙏🏽
@PhilippLackner
@PhilippLackner 2 жыл бұрын
Glad my stuff helps!
@matt-g-recovers
@matt-g-recovers 2 жыл бұрын
Speak for yourself... I find that Philipp's tutorials are not valuable. ;) They are absolutely priceless!!!
@ajailani4
@ajailani4 2 жыл бұрын
This video is helped me a lot. I didn't know about encryption and decryption specifically before. After I watched this, at least I know them and those implementation on Android. Super cool!
@asadullahilyas
@asadullahilyas 2 жыл бұрын
At time 12:00, you mention that we can get existing key from keystore. But while creating a new key, we're not mentioning our keystore anywhere. So how does this keystore know which key is being created and added against "secret"?
@johndominicjasmin
@johndominicjasmin 2 жыл бұрын
This channel is gold!
@halvtysk
@halvtysk 2 жыл бұрын
Interesting subject. I remember investigating this a couple of years ago, but was put off by the complexity trying to solve this for pre-M-devices. Would be interesting to see your take on that.
@Pulkit__7
@Pulkit__7 Жыл бұрын
I need to create a video/blog for pre-M devices. But is it worth it now? Are people even targeting apps for devices below android 6?
@josephofem5448
@josephofem5448 2 жыл бұрын
Hey Phil, In my Nigerian accent, "You are doing well"😁. Thanks for all you do
@emmanuelpregnolato5026
@emmanuelpregnolato5026 2 жыл бұрын
Tx Phil for the tutorial, truly hope you get your 100k subs by EOY.
@ItsmeFewrie
@ItsmeFewrie 11 ай бұрын
for some reason even after following everything the decrpytion doesnt work, I've also tried cloning your github project & it gives me the same issue, there's not much documentation on this either
@devenderchaturvedi9903
@devenderchaturvedi9903 2 жыл бұрын
Wow, I've been waiting for your video with my coffee. Finally, It's coffee time now☕
@ubersticks
@ubersticks 2 жыл бұрын
Get a coffee for Philip too! kzbin.info?event=video_description&redir_token=QUFFLUhqa0JpcHBjcU9WOVFkbThlQjVjeDhuemlvRmxTZ3xBQ3Jtc0tsdlhYdTBmY1ZvWjZTRTVnRDROZXRLWHZlQWNsWUQwdU4zRUxHWjlreDBqdUdTZEhKTndlRFhQazRtZXVZYUd3aW1MVTh1R3ZRWDhZUlRDVUx6ZWllNHlsNzAtNDNpQUE5N3lXOVRtUzFRS3BaU3d5Yw&q=https%3A%2F%2Fwww.buymeacoffee.com%2Fphilipplackner&v=aaSck7jBDbw
@denisgithuku8563
@denisgithuku8563 2 жыл бұрын
Been waiting for this
@typicalashish5555
@typicalashish5555 Жыл бұрын
how to choose between encrypted shared preference and keystore. What are advantages/ disadvantages over each other.
@asadansar6214
@asadansar6214 7 ай бұрын
Hi @Phillip, I am your big fan, learning android continuously from your videos. Please make a video on SSL Pining in android.
@algo_chronicles
@algo_chronicles 2 жыл бұрын
i am getting bad padding exception
@takenote8268
@takenote8268 2 ай бұрын
In case someone gets it - try using a longer phrase to encrypt, not just "test" or something as small as that
@osisuper98
@osisuper98 2 жыл бұрын
Unbelievable content like always.
@greeken3528
@greeken3528 2 жыл бұрын
aah, i just got into making soft rn and tNice tutorials is so helpful and your voice is so sootNice tutorialng btw! thanks for tNice tutorials tutorial
@mrjackson9137
@mrjackson9137 Жыл бұрын
Hi Philip, please create more videos like this, thank you so much!
@rubansinghjohn8055
@rubansinghjohn8055 3 ай бұрын
With the alias name anyone can read and access keystore keys. How to prevent this???
@matt-g-recovers
@matt-g-recovers 2 жыл бұрын
I have a Verizon device. While I didn't appreciate that I could not root my device, I can appreciate the security of the whole deal.
@King_Kendhammer
@King_Kendhammer 2 жыл бұрын
Love these videos. Do you slow down a bit in your programs? I find it hard to keep up sometimes
@mehdiparsaei1867
@mehdiparsaei1867 3 ай бұрын
Thank dear Philipp. A question, why did you use the output stream parameter in encrypt fun?
@ubersticks
@ubersticks 2 жыл бұрын
Cool, thanks! Looks like this crashes if you try to re-encrypt the same input string (" IV has already been used. Reusing IV in encryption mode violates security best practices"). Is there an explanation for what is wrong in the example here?
@PhilippLackner
@PhilippLackner 2 жыл бұрын
Ohh, you might need to make the encrypt cipher a function instead, so it generates a new one when you re-access it. Sorry my bad
@ubersticks
@ubersticks 2 жыл бұрын
@@PhilippLackner Yes that worked. For reference: fun encrypt(bytesIn: ByteArray, outputStream: OutputStream): ByteArray { val cipher = encryptCipher() //
@simonanikolova1719
@simonanikolova1719 Жыл бұрын
@@ubersticks can you please show us what the encryptCipher() looks like now ?
@ubersticks
@ubersticks Жыл бұрын
@@simonanikolova1719 see the previous reply -- it has the function
@simonanikolova1719
@simonanikolova1719 Жыл бұрын
@@ubersticks I meant the code for the encryptCipher transformed to function but I figured it out. Here is my code if anyone else needs it in the future: private fun getEncryptCipher(): Cipher { return Cipher.getInstance(TRANSFORMATION).apply { init(Cipher.ENCRYPT_MODE, getSecretKey()) } }
@EnricoAncis
@EnricoAncis Жыл бұрын
Hi Philipp, great guide! How can I do if I would to store and load an encrypted string into/from a Room field? Thank you
@youngtigersivateja
@youngtigersivateja 2 жыл бұрын
Hi Phillip, thanks for the tutorial. But can you please help us understand how to save, get, update and delete EncryptedSharedPreferences?
@AriefHidayatDev
@AriefHidayatDev 2 жыл бұрын
your content is awesome, but i have a problem that some people can decompile assets folders from apk and stolen my android assets. my question is how to secure the assets folders? best regards
@shawnmichaels5484
@shawnmichaels5484 2 жыл бұрын
Hey great video! May I know which mac you are using btw?
@Chirag-Redij38
@Chirag-Redij38 Жыл бұрын
Instead of saving to a file I can directly save the ByteArray to a datastore right?
@TheMightyN
@TheMightyN Жыл бұрын
Why would Samsung equip this mode onto a touch sensitive device? Imagining the scenario where some person activating the Encryption via butt dial--now--is left permanently scarred with the decision to hard reset their data while losing their files in the process? That's not cool.
@jaydeepbhayani
@jaydeepbhayani 2 жыл бұрын
which font do you use in android studio?
@haykmkrtchyan7093
@haykmkrtchyan7093 2 жыл бұрын
That's just incredible, thank you man ❤️
@rvnareshkumar
@rvnareshkumar 2 жыл бұрын
Can you do a video on build gradle using KTS
@welomehell
@welomehell Жыл бұрын
What does iv stands for?
@adrianagape8472
@adrianagape8472 2 жыл бұрын
I fucking love you mate!! I saw a lot of videos for soft but tNice tutorials one is handsdown the best one! Love how your super calm and really take
@ChrisAthanas
@ChrisAthanas 2 жыл бұрын
The source code on your github has references to "Username / Password" load and save, but crashes when tried. Was this an oversight?
@dmytromarchuk3023
@dmytromarchuk3023 4 ай бұрын
If an attacker knows "secret", can the SecretKey be loaded and used to decrypt and access your data?
@skarbanan
@skarbanan Жыл бұрын
How would that be possible to implement to encrypt / decrypt an app db upon opening and closing an app? Ofc, a user would have to input the pass upon opening the app
@aliciabeltran
@aliciabeltran 11 ай бұрын
Hi, I will like to know if should we save or use inputStream/outPutStream and files to persist the data? Where should we save it?
@LukitaSukita
@LukitaSukita 2 жыл бұрын
Great video! Thank you Philipp
@vengateshm2122
@vengateshm2122 2 жыл бұрын
Can we write the encoded string to preference datastore?
@codingcosmos7010
@codingcosmos7010 2 жыл бұрын
I wanna encrypt a string & decryption will happen at server side.. what would be good & secure way of implementing it?
@ErickRicoP
@ErickRicoP 2 жыл бұрын
Does it make sense for you to encrypt the Room database with SQLCipher? I've been reading information on forums and watching some videos, but I'm really not sure if it's a good practice. Thanks for sharing your expertise.
@DevDiscipline
@DevDiscipline 2 жыл бұрын
thanks man !!! you're the best
@chanikafernando4928
@chanikafernando4928 Жыл бұрын
Greate tutorial, if we.have to encrypt entire app, including all the files, what would be the best way?
@АрсенийСтучинский-в1ъ
@АрсенийСтучинский-в1ъ 2 жыл бұрын
Such a shame I probably can't buy your courses from my country. But thank you for your content, I have recently landed my first Android dev job after learning by watching your videos and trying to replicate stuff from them.
@PhilippLackner
@PhilippLackner 2 жыл бұрын
Thanks, but why not? Assuming you're from Russia, you could still get them by using a VPN + entering a different country during checkout.. Had some customers who did this and it worked well. Of course only if you don't need the invoice as business expense or so
@АрсенийСтучинский-в1ъ
@АрсенийСтучинский-в1ъ 2 жыл бұрын
@@PhilippLackner Yeah, I thought of that way too, but I am currently studying at university, so I wonder if I'll have time to travel to another country before next summer. I wonder if I can somehow bypass all this stuff with a SIM card that came from a different country, that would be way easier. I'm coming for dat Compose course sooner or later though ヽ(ಠ_ಠ)ノ
@PhilippLackner
@PhilippLackner 2 жыл бұрын
@@АрсенийСтучинский-в1ъ who speaks of traveling to another country 😅 stay where you are and enter something else together with an active VPN
@АрсенийСтучинский-в1ъ
@АрсенийСтучинский-в1ъ 2 жыл бұрын
@@PhilippLackner oh, I misunderstood the "entering from another country" part :D Alright, I'll check out how this is done later, thanks
@PhilippLackner
@PhilippLackner 2 жыл бұрын
@@АрсенийСтучинский-в1ъ lmao, no I mean during checkout just selecting a country different from russia😂
@rfviratsingh
@rfviratsingh Жыл бұрын
Hey dear I want to download a video from 1dm application but when I start downloading the video it says 16 byte AES-128 decryption key in base 64 format is required. Can you please make a video on it.
@kulupaji
@kulupaji 8 ай бұрын
hey i have very important data encrypted in a format like this it is of a crypto wallet how do decrypt it like it is really important help
@adlisamy9900
@adlisamy9900 2 жыл бұрын
Thank you for this video, i was wondering how do we do the same with Asymetric Keys like RSA ?
@AdamArtAnanda
@AdamArtAnanda Жыл бұрын
I am wondering if one could fake my app with the same package name and use the keystore to decrypt files which should only be decrypted from my app.
@tiagocarvalho386
@tiagocarvalho386 2 жыл бұрын
What about importing midi files because most midis freezes my program. What can I do about it? I'm using soft soft Bundle Pack by
@hardcorewrestlingmalyalam
@hardcorewrestlingmalyalam 11 ай бұрын
Sir, android encription prevent data recovery?
@rolexAltron
@rolexAltron 7 ай бұрын
i have physical image of android phone in binary fromat having file base encryption and i have key also , i want to decrypt that image how should i process further 'please help me on this
@aliciabeltran
@aliciabeltran 11 ай бұрын
in MVVM where should be the CryptoManager?
@himanshukandwal3203
@himanshukandwal3203 8 күн бұрын
U will have flow like UI-->Viewmodel -->Viewmodel -->repository(and data source if u need) Repository or data source class will use cryptomanger
@yoman796
@yoman796 2 жыл бұрын
Hi. I got java.lang.IllegalStateException: IV has already been used. Reusing IV in encryption mode violates security best practices. Can you tell me how to implement this with random IV?
@mrbmro3991
@mrbmro3991 Жыл бұрын
What about using a random salt?
@azamovdev
@azamovdev Жыл бұрын
The video is great. you are the best
@DayZTheBetterVanilla
@DayZTheBetterVanilla 2 жыл бұрын
Not only liked the video, loved it
@shubhamshinde-lt7hr
@shubhamshinde-lt7hr 2 жыл бұрын
One request: please make a video on Play Integrity API as a part of this security series. If possible.. Btw lots of thanks.
@justpain3439
@justpain3439 2 жыл бұрын
that was so use full! !
@MiguelRamirez-vm1ni
@MiguelRamirez-vm1ni 2 жыл бұрын
Will be following
@cularu1
@cularu1 2 жыл бұрын
Can an app access the key from another app by specifying the key alias?
@PhilippLackner
@PhilippLackner 2 жыл бұрын
Of course not 😅
@taniakhan5319
@taniakhan5319 2 жыл бұрын
Would it be possible to email you a question?
@mathias0584
@mathias0584 Жыл бұрын
Can you do the same thing with pictures? I would like to encrypt and decrypt pictures
@PhilippLackner
@PhilippLackner Жыл бұрын
sure, the computer only knows bytes
@mathias0584
@mathias0584 Жыл бұрын
@@PhilippLackner So, I can follow this example and use your class to encrypt/decrypt pictures?
@mustafaammar551
@mustafaammar551 2 жыл бұрын
YOU ARE THE BEST 👍👍👍👍👍👍
@aniketshinde4114
@aniketshinde4114 2 жыл бұрын
Can u make video on Encrypting and decrypting image in android
@rizkynovandri1100
@rizkynovandri1100 2 жыл бұрын
THanks for the help. My friend reconded tNice tutorials software and I was very comfused
@orangasli2943
@orangasli2943 2 жыл бұрын
Bro..if my manifest file written in XML code.. will it be compiled into java byte code or .APK file.. Can some one change the configuration in that .APK file from outside the app for example from another Android app on a device? Because I heard XML is not secure because it can be converted into JSON.. but if it is a java byte code probably it is much secure than XML
@maskedredstonerproz
@maskedredstonerproz 2 жыл бұрын
manifests don't get compiled, besides, even if someone were to manipulate the manifest file, there's little they can do
@chaitanyasalwan6711
@chaitanyasalwan6711 2 жыл бұрын
Hi Philipp can you make a separate course on Android Security for offline as well as online system cause there are some tools(http canary) which can capture https data. Even ssl pining is useless there are tools which can disable them . Even signature verifications(ultima - a tool that kills every signature protection) are useless these days , using NDK is safe but there are no tutorials on web for the same
@amoljunghare3610
@amoljunghare3610 Жыл бұрын
Do you know about Op-TEE? If u know can u make a video on this how to integrate OP-TEE in Android studio
@AntonTorkhov
@AntonTorkhov 2 жыл бұрын
The app crashed after I pressed the decrypt button. What am I doing wrong?
@sarvarkhalmatov6417
@sarvarkhalmatov6417 2 жыл бұрын
@Philipp Lackner , thank you for all your efforts. I learned a lot from you! Please suggest me a book that covers android development topics that helps to learn android in depth(the newer the better). Thanks beforehand 😊
@Akshaykumar-xr9yj
@Akshaykumar-xr9yj 2 жыл бұрын
Hello bro i am interested in your multi module android development course. Will there is 25% discount in future again.
@PhilippLackner
@PhilippLackner 2 жыл бұрын
Sorry I don't often have discounts. Surely there will be on future, but not in the next months
@2uur
@2uur Жыл бұрын
هل يوجد ترجمه للغه العربيه
@ashwinpatidar2878
@ashwinpatidar2878 2 жыл бұрын
Thanks Philipp Sir 🤟👍👍
@PhilippLackner
@PhilippLackner 2 жыл бұрын
You're welcome
@justscribeyourthought9855
@justscribeyourthought9855 2 жыл бұрын
Really helped in 19 thx
@maximooze3196
@maximooze3196 2 жыл бұрын
Day 1 requesting for a Sonar Qube tutorial ✌️
@Tibi73
@Tibi73 9 ай бұрын
Oh man, you so fucking helped me. Thank you so much!
@gregcullen8744
@gregcullen8744 2 жыл бұрын
Nice video. Lets say you encrypt a file and copy it off your device to a server. Your device crashes, breaks, gets lost. Your keystore is gone. How do you read/open the file you copied off the device. Also, is the keystore backed up by google? Can you transfer and use the keystore onto a different device? How to protect yourself from having all your eggs in one basket?
@PhilippLackner
@PhilippLackner 2 жыл бұрын
Nope, then you gotta manage your own key, but also carry the risks. You can't have both the advantages of having a key that can't leave the device and being 100% flexible
@mrbmro3991
@mrbmro3991 Жыл бұрын
​@@PhilippLacknerwhy not also use a random salt
@BouchentoufZakaria
@BouchentoufZakaria 10 ай бұрын
Love you ❤
@ahmedsakran3366
@ahmedsakran3366 Жыл бұрын
you are amazing 💯💯💯👌🤚🤚🤚❤❤❤
@fhaaj66
@fhaaj66 2 жыл бұрын
I ain't got exams per say, but I'm tryna study for an IT certification... TNice tutorials is more important tho
@argahutama
@argahutama 2 жыл бұрын
Awesome
@nielat83
@nielat83 2 жыл бұрын
ong thats how i am right now
@TheSleeep
@TheSleeep 2 жыл бұрын
first 😎
@patrickangeloamable7784
@patrickangeloamable7784 Жыл бұрын
I cloned the project from GitHub but when I tried to run the project I am getting a javax.crypto.AEADBadTagException caused by Caused by: android.security.KeyStoreException: Signature/MAC verification failed error
@wawrzyn3059
@wawrzyn3059 Жыл бұрын
I had the same
@mostafaelnagar900
@mostafaelnagar900 2 жыл бұрын
Legend 😍
@jatinvashisht4293
@jatinvashisht4293 Жыл бұрын
If anyone is getting following error: "IV has already been used. Reusing IV in encryption mode violates security best practices." I solved it by initializing the encryptCipher each time I try to encrypt something. Like this: private val encryptCipher = Cipher.getInstance(TRANSFORMATION) fun encrypt(bytes: ByteArray, outputStream: OutputStream): ByteArray { encryptCipher.init(Cipher.ENCRYPT_MODE, getKey()) // rest of the code } I don't know if this is correct way to do this but functionality worked correctly after this change.
@AmitRanjan-xt2th
@AmitRanjan-xt2th 6 ай бұрын
Same Issue , it's right way to do ? Have to change only the random IV not the key
@sumit_soni
@sumit_soni 2 жыл бұрын
Phillip 🔥🔥🫂
5 Fatal Coroutine Mistakes Nobody Tells You About
18:15
Philipp Lackner
Рет қаралды 89 М.
Мен атып көрмегенмін ! | Qalam | 5 серия
25:41
人是不能做到吗?#火影忍者 #家人  #佐助
00:20
火影忍者一家
Рет қаралды 20 МЛН
The Honey Scam: Explained
10:53
Marques Brownlee
Рет қаралды 4,5 МЛН
Full Guide to Delegation in Kotlin  - Android Studio Tutorial
18:10
Philipp Lackner
Рет қаралды 72 М.
Shrink, Optimize and Secure Your App With R8 & ProGuard - Full Guide
18:08
WorkManager - Android Basics 2023
34:22
Philipp Lackner
Рет қаралды 64 М.
THIS Is How You Measure the Performance of Your Android App
21:30
Philipp Lackner
Рет қаралды 45 М.
Full Guide to Jetpack Compose Effect Handlers
24:56
Philipp Lackner
Рет қаралды 100 М.
Мен атып көрмегенмін ! | Qalam | 5 серия
25:41