[Q] How to get ReponseData and Signature for android LVL - Android Q&A, Help & Troubleshooting

Hi,
I try to implement a server side verification of an application with LVL library.
I use this php code : http://code.google.com/p/android-market-license-verification/
In the file sample/verify.php, I have two lines to complete :
Code:
$responseData = '';
$signature = '';
I see in the google LVL that there is a function called verify which has these parameters :
public void verify(PublicKey publicKey, int responseCode, String signedData, String signature);
But I don't undestand where this function is called and by what function.
Also I want to get this datas.
How can I do that ?
Thank you,

Yeah!! Same here!
Can someone tell us?
Most apps use client side license verification, don't know why... This would be very useful!

Related

[R&D] Upload files with DropBox

Hi, this is my code, i cant get upload a simple file:
Signgin in to DropBox:
.....private AccessTokenPair tokensDB;
.....private DropboxAPI<AndroidAuthSession> mDBApi;
.....final static private AccessType ACCESS_TYPE = AccessType.DROPBOX;
.....AppKeyPair appKeys = new AppKeyPair(APP_KEY, APP_SECRET);
.....AndroidAuthSession sesDropBox = new AndroidAuthSession(appKeys, ACCESS_TYPE);
.....mDBApi = new DropboxAPI<AndroidAuthSession>(sesDropBox);
.....mDBApi.getSession().startAuthentication(this);
When activity resums this code is executed:
.....mDBApi.getSession().finishAuthentication();
.....tokensDB = mDBApi.getSession().getAccessTokenPair();
when the user clicks over a button in same activity next code is executed:
protected void subeArchivos() {
.....// Uploading content.
.....String fileContents = "Hello World, this is only an example!!";
.....ByteArrayInputStream inputStream = new ByteArrayInputStream(fileContents.getBytes());
.....try {
..........mDBApi.putFile("/testing.txt", inputStream, fileContents.length(), null, null);
..........//Log.i("DbExampleLog", "The uploaded file's rev is: " + newEntry.rev);
.....} catch (DropboxUnlinkedException e) {
..........// User has unlinked, ask them to link again here.
..........Log.e("DbExampleLog", "User has unlinked.");
.....} catch (DropboxException e) {
..........toast = Toast.makeText(getApplicationContext(), "C U A: " + e.getMessage(), Toast.LENGTH_SHORT);
..........toast.show();
..........//Log.e("DbExampleLog", "Something went wrong while uploading.");
.....}
}
The code in red throws error. and after the conde in yellow is executed.
My mnifiest permissions are:
.....<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
.....<uses-permission android:name="android.permission.INTERNET"></uses-permission>
.....<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"></uses-permission>
P.D. All works, exept code in red!!
I hope you can help me!! thx!!
anyone??
I didn't understand anything exc. that you can't upload any file with Dropbox, but I had similar problem. Seems you shouldn't delete the Downloads app, else it bugs DB uploads.
Hope it helps.
thx man, every folder in his place, but maybe something in my code is wrong!!

[Q] NullPointerException when trying to access MainActivity from different class

Hi!
I am trying to develop an android app with a google map v2, location service and some control buttons.
But I don't want to put all these things inside one MainActivity class. So I thought I could split all the code into some more classes. The MainActivity shall controll all the GUI things and react on map or location events...
Now I have the following problem. Inside my onCreate I instanziate the additional classes:
Code:
// Preferences as singleton
pref = Prefs.getInstance(this.getApplicationContext());
pref.loadSettings();
// Set up the location
loc = new Locations(pref);
loc.setCallback(this);
map = new MyMap(pref);
It seems to work fine. But inside the MyMap class every time I start the app a null pointer exception is thrown. When I am calling MyMap() the following code will be executed:
Code:
[...]
private Prefs pref;
private GoogleMap mMap;
[...]
public MyMap(Prefs prefs) {
pref = (Prefs) prefs;
if (mMap == null) {
FragmentManager fmanager = getSupportFragmentManager();
mMap = ((SupportMapFragment) fmanager.findFragmentById(R.id.map)).getMap();
[...]
}
The line with the findFragmentById is the one that causes the exception.
If I write
Code:
SupportMapFragment f = ((SupportMapFragment) fmanager.findFragmentById(R.id.map));
f is allways null. But how can I access the fragments and view elements defined within my MainActivity?
It works if I put the code inside my MainAcitivity.
Every class extends "android.support.v4.app.FragmentActivity"
I tried to save the application context within my Prefs() class, so that I can access it from everywhere.
But I don't know how to use it inside my additional classes.
How to share the "R" across all my classes?
Can someone help me please?
Thank you very much!!
Thorsten
Are you having trouble adding a Map to a Fragment? If so, then you may take a look at this tutorial. I haven't tried it myself since I couldn't install Google Play Services on my development device. If it helps, do write back, as I am definitely going to try it myself soon.

Invalid Android ID (aid:0)

Hi guys...
Since few weeks now, i'm facing to an unsolvable trouble that prevent me to access to google play (with the famous error "No Connexion"). I spent hard time to search why, tried some fixes found on the web... Nothing works.
This morning, i found with the Android Device-ID application that my "GSF Device-ID" is set to "null" ! Said differently, i'm pretty sure that my device (Samsung Galaxy S2) can't be recognized and identified on Play store because of this, giving me the "No Connexion" error.
Does anybody here know how i could fix this invalid ID (which is confirmed with the *#*#8255#*#* trick : aid:0 (INVALID AID!!!)
Thanks in advance for your help.
cheers
UP.
Nobody can help ? i can't believe it according to the number of gurus here
I am more and more convinced that the secret of this famous GSF ID is jealously guarded by its creators, and finally how to handle it are not or little known ... And for good reason, since this is for Google one of the only way to identify and thus tracking devices safely and reliably. Make it easily editable would be a disaster for them I guess ...
I still dare to hope that some geniuses who frequent this forum have already faced this problem and had pierced the mystery and how to handle this identifier.
I found the beginning of an answer with the sources code of an app "Android ID" :
Code:
private static final Uri URI = Uri.parse("content://com.google.android.gsf.gservices");
private static final String ID_KEY = "android_id";
String getAndroidId(Context ctx) {
String[] params = { ID_KEY };
Cursor c = ctx.getContentResolver()
.query(URI, null, null, params, null);
if (!c.moveToFirst() || c.getColumnCount() < 2)
return null;
try {
return Long.toHexString(Long.parseLong(c.getString(1)));
} catch (NumberFormatException e) {
return null;
}
}
In my case, i get a "null" for GSFID. That means no columns are found in reply to the query.
I have verified this by installing aSQLiteManager on my SGS2, and opening the gservices.db database.
My problem now is to find what are the key fields
that are supposed to be filled in order to have a GSF value returned.
Maybe some of you could provide me this information by having a look to your own configuration.
Thanks in advance.
I've got same problem
My phone is LG Optimus L5 and after I rooted my phone,I've got same problem and I couldn't connect to Google products and my AID's been null!

adb raw protocol AUTH

Hello,
as the title says, i have some trouble with the A_AUTH packet. I currently write my own implementation of the adb protocol for my AndroidCtrl.dll everything works so far as expected, only the token signing left...
QUESTION:
Can someone kick me in the right direction, how i can successfully sign the A_AUTH token?
My tries [C# .Net 4 Client]
Code:
//Class internal var
RSACryptoServiceProvider _rsaSP = new RSACryptoServiceProvider(2048);
// (my own loader) Load the xml saved RSA-Key
RSALoad()
// generate the signed hash
// (don't work)
byte[] shash = _rsaSP.SignData("20 byte token from A_AUTH", new SHA1CryptoServiceProvider()));
// generate the signed hash
// (don't work)
byte[] shash = _rsaSP.SignData("20 byte token from A_AUTH", new SHA256CryptoServiceProvider()));
I also tried it with "_rsaSP.SignHash()" but no luck... Seems .Net is not capable to sign a adb token... If i send my public key, on the device the adb dialog pops up and ask me to grand access. So the device have the public key. But it sends all the time a new token after i send my signed token...
THX in advance
Sebastian

Reflection from one app to another app - Access data

I am trying to figure out how to use reflection to access field data from another apk.
Both apks are in debug and signed with the same certificate and they are sharing the same user id. I built out the method to use reflection to retrieve the field value from the other apk.
Code:
public Class<?> getClass(String remoteClass) throws Exception {
Context remoteContext = mContext.createPackageContext(REMOTE_PACKAGE,
Context.CONTEXT_IGNORE_SECURITY | Context.CONTEXT_INCLUDE_CODE);
ClassLoader loader = remoteContext.getClassLoader();
Class<?> cls = loader.loadClass(remoteClass);
return cls;
}
public Object getField(String obfuscatedClass, String obfuscatedField) throws Exception {
try {
Field field = this.dexLoader.getClass(obfuscatedClass).getDeclaredField(obfuscatedField);
field.setAccessible(true);
return field.get(this.reference);
} catch (NullPointerException | IllegalArgumentException | IllegalAccessException | NoSuchFieldException
| SecurityException | ClassNotFoundException e) {
}
return null;
}
Example:
A - APK (A)
In APK (A) I am running the application and while it is running their is real-time data being set...
B - APK (B)
With APK (B) I have the method getClass in which I will use to access the package from APK (A) and then pull the declared field in the package.
The issue is every time I run the apk that uses the reflection on the running application it just returns the default value that the field started with. In java you can use reflection to access a jvm's field values/methods while it is running. I am trying to do the same approach with the android applications but it doesnt look like it is returning real-time data.
Am I doing this all wrong or is this just not possible?
Another thing I am able to do is decompile the running application and make any additions/modifications I want and then recompile. Is there anything I can do to be able to use reflection to retrieve the data from the field values in real-time. Everything is public and static in the apk.
Thank you for your time to whoever is reading this!
Maybe if I were to inject into the other APK reflection methods and then I can use the other apk to invoke the reflection method with reflection to pull data?

Categories

Resources