Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9250625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:29:14+00:00 2026-06-18T10:29:14+00:00

In my folder assets/data , there are a lot of XML files containing static

  • 0

In my folder assets/data, there are a lot of XML files containing static data for my app.

It’s really easy for someone to retrieve an APK, modify a part of it and install on a device.

I would like to prevent users to alter my static data by checking the integrity of my assets/data folder.

Initially I was considering to use MD5 checksum, but it will probably be too slow for the amount of files I gonna have (50-100).

Do you have any suggestion?

Edit:

This app is a game with an XML file describing each level.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T10:29:15+00:00Added an answer on June 18, 2026 at 10:29 am

    I’ll describe how you can effectively protect against modification and repackaging, not how you can protect the assets on their own, although you could ultimately apply the same technique to encrypting them. It’s imperfect, but you can make modification significantly more difficult.

    You sign the application with a certificate. Although they can remove yours, noone else can produce the same certificate when putting it back together. You can therefore check the signature of the application at runtime, to make sure it’s what you expect.

    Here’s some cheap and nasty code to do this:

       PackageManager pm = context.getPackageManager();
    
       PackageInfo info = pm.getPackageInfo( context.getPackageName(), PackageManager.GET_SIGNATURES );
    
       if ( info.signatures[ 0 ].toCharsString().equals( YOUR_SIGNATURE ) )
       {
         //signature is OK
       }
    

    where YOUR_SIGNATURE is a constant, obtained from running this code on the signed app.

    Now, there are two remaining problems that you have already hinted at:

    1. how can you stop someone just modifying the constant in the source code to match their certificate, then repackaging and re-signing the app?

    2. how can you stop someone finding the check method and removing it?

    Answer to both: you can’t, not absolutely, but you can do a pretty good job through obfuscation. The free Proguard, but more usefully the commercial Dexguard, are tools for doing this. You may baulk at the current €350 cost of the latter; on the other hand, I have tried to reverse engineer apps that are protected like this, and unless the stakes were very high, it isn’t worth the trouble.

    To an extent, you could also do the obfuscation for (1) yourself; have the signature ‘constant’ assembled at runtime through some complicated programmatic method that makes it difficult to find and replace.

    (2) is really a software design issue; making it sufficiently complicated or annoying to remove the check. Obfuscation just makes it more difficult to find in the first place.

    As a further note, you might want to look at whether stuff like Google Licensing gives you any protection in this area. I don’t have any experience of it though, so you’re on your own there.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way to load JavaScript from public folder before JavaScript-files from assets/javascript
I am parsing an XML file from assets folder to dump my data into
I want to change WebView font. There are 2 files in assets folder. They
I have an app receiving its data from a database in the assets folder.
I have created application where i just need to access data form assets folder.
can we keep a video in the assets folder, i am developing an app
How to show a list of all PDF files stored in assets folder or
Please help me with following problem. In my android assets folder I have xml
guys, I have the problem when copying database from local assets folder to /data/data/package_name/databases
I am creating an app that involves reading data from text files that are

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.