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 9176067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:01:13+00:00 2026-06-17T17:01:13+00:00

From Android In App Billing version 3 (TrivialDrive)sample application coming with sdk MainActivity.java /*

  • 0

From Android In App Billing version 3 (TrivialDrive)sample application coming with sdk

MainActivity.java

/* base64EncodedPublicKey should be YOUR APPLICATION'S PUBLIC KEY
 * (that you got from the Google Play developer console). This is not your
 * developer public key, it's the *app-specific* public key.
 *
 * Instead of just storing the entire literal string here embedded in the
 * program,  construct the key at runtime from pieces or
 * use bit manipulation (for example, XOR with some other string) to hide
 * the actual key.  The key itself is not secret information, but we don't
 * want to make it easy for an attacker to replace the public key with one
 * of their own and then fake messages from the server.
 */
String base64EncodedPublicKey = "CONSTRUCT_YOUR_KEY_AND_PLACE_IT_HERE";

Well I am not sure I understand this security measure. I know how to get the application public key (which is already base 64 encoded) from Google Play Developer Console.

What I am not understanding is this part

 /* Instead of just storing the entire literal string here embedded in the
 * program,  construct the key at runtime from pieces or
 * use bit manipulation (for example, XOR with some other string) to hide
 * the actual key
 */

As far as I know, this public key is a constant string, which is given from Google during application upload process.

How can we create the same key programmatically using any bit manipulation process? Has someone done it before? Is there any sample code on how to do this?

  • 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-17T17:01:14+00:00Added an answer on June 17, 2026 at 5:01 pm

    Something like this:

    String Base64EncodedPublicKey key = "Ak3jfkd" + GetMiddleBit() + "D349824";
    

    or

    String Base64EncodedPublicKey key = 
             DecrementEachletter("Bl4kgle") + GetMiddleBit() + ReverseString("D349824");
    

    or anything that doesn’t put the key in base64 plaintext in a single string. Probably also something that doesn’t store the key in base64 would be a good idea too, since raw base64 text fragments are pretty easy to spot.

    It’s not a particularly GOOD way to protect the key. But it protects against a trivial attack where somebody just searches through literal strings in you APK looking for something that looks like a base64-encoded public key. At least you make the #$#$ers work a little bit.

    Presumably evil people can do bad things if they identify your public key. Google seems to think so, apparently. I can guess what this step does, but I’m not sure I really want to speculate on that in an open forum, and give anyone any ideas. You want to do it though.

    The basic plot summary would be that you’re making it more difficult for somebody to write an application that programmatically de-LVLs an applciation.

    One assumes that anyone who’s doing this makes a living cracking 20 or 30,000 android apps and republishing them. Chances are, I suppose that they’re not going to take the extra ten minutes to add your app to the list of 20,000 Android apps that have already been broken by a program, if they actually have to do a little bit of manual work. Unless you have a top tier application. And then the battle is potentially endless, and probably ultimately futile.

    Splitting the key into consecutive chunks (as proposed in another answer) probably isn’t good enough. Because the key will end up in consecutive strings in the string constant tables in the APK. Too easy to find that with a program.

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

Sidebar

Related Questions

I've been looking for the in-app billing's offical sample app from Android Developers and
I have android app . i should pass the data from android to web
I have successfully implemented this from android to a java httpservlet on google app
While implementing the in-app billing for Android application, I came across a problem. Let
Is it possible to request last version of App from Android Market via API
I'm testing out the billing sample application provided by google: http://developer.android.com/guide/market/billing/index.html Everything is going
I am using in-app billing from Google for Android for the first time. However,
I am trying to test in-app billing in my Android application. The problem is,
The README for the market billing sample states: In-app billing requires version 2.3.0 of
i have created a test application with in app product in google play. http://developer.android.com/guide/market/billing/billing_admin.html

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.