r/androiddev • u/koje1971 • 19d ago
Question String protection against decompilation
If I have a string in a class file and want to protect it as best as possible against decompilation and analysis, are there any ideas? I know it can't really be fully protected, but I want to make it as hard as possible. Ideally, with minimal effort.
13
Upvotes
7
u/YSoSkinny 19d ago
You can encrypt/ decrypt the strings
7
u/mreeman 18d ago
Encrypt it and split it in various places (hard coded strings) then reassemble it using a c binary linked via jni which clears memory immediately after it is used, decrypting using a key fetched from a server via TLS with certificate pinning to stop mitm inspection.
Obfuscate the class files and implement anti debugging measures (root detection, debugger detection, etc) which immediately flush memory, or replace it with a junk version.
LLMs will be able to extract it for a few hundred bucks I guess.
66
u/Xavinights 19d ago
Server side variable fetched at launch time
4
u/zunjae 19d ago
What are you hiding?
3
u/HaMMeReD 19d ago
What is in these strings?
17
u/ldn-ldn 19d ago
Stop wasting your time. If people cracked Denuvo, they will get your strings in no time.
12
u/jc-from-sin 19d ago
12
u/crjacinro23 19d ago
Use native C library and store the strings there hidden using XOR operations
3
u/r4md4c 19d ago
Save them on RemoteConfig, and use AppCheck to ensure no app other than yours can fetch them.
4
u/Michami135 19d ago
All my ideas have already been mentioned, but I will say: it's incredibly easy to hack any of these using AI now. You can fool a human, but not a computer.
2
u/summner 19d ago
add werid obfuscations, to a point where your reverseengineer run triggers Codex cyber protections.
That is your only protection.
Codex/Cyber Cyber and unlocked good opensource models are unstoppable otherwise.
2
u/SuffixRE 19d ago
I'd store the level descriptions encrypted (AES-256-GCM) on a server, then verify the app's signature, version and Play Integrity when it connects. If valid, issue a temporary session key and let it download the encrypted data. Decrypt it only when needed using native C++ (NDK), with R8 and stripped native symbols to make reverse engineering harder. Remember that nothing is unbreakable :)
2
u/BigUserFriendly 16d ago
La più difficile in assoluto è quella inesistente.
2
u/kokeroulis 16d ago
You cant. You can fool a human but not Claude on a $20 sub.
1
u/AutoModerator 19d ago
Please note that we also have a very active Discord server where you can interact directly with other community members!
Join us on Discord
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/fiojoy 19d ago
encrypt/ decrypt code
1
u/[deleted] 19d ago
Just rely on PairIp for now. It still fcks up any modders out there because it's really hard to bypass.
1
u/Zhuinden 19d ago
Honestly, Claude Opus can rip it apart these days, so who knows? But you can try
1
u/Ovalman 19d ago
Upload them to Firebase/ Firestore and only use them at runtime?
1
u/VariousPizza9624 18d ago
Use an obfuscation lib like Paranoid: https://mvnrepository.com/artifact/com.joom.paranoid/paranoid-gradle-plugin/0.3.16
1
u/Ayano-Keiko 17d ago
save it in server and use decryption algorithms to decrypt it?