views:

55

answers:

1

I have a native android library (.so) I am bundling with some application. In the native code I want to verify the signer/package name of the calling application.

The reason is, currently anyone can open up the .apk file take my .so file and use it to built their own applications.

Is there a way to securely identify the calling application from Java side? This could be package name, signature or anything else that can identify the Android application in a unique way.

+2  A: 

JNI code is coupled with Java package name, and can be called only from the same package and class. To improve security further, you can check some Java private static final field from the JNI code.

ognian
Another application can just use the same package and class name to call the functions. That is not difficult, they just need to look at the list of exported functions from the .so file.But I guess, private static final field could add additional security. An attacker still can get around this by disassembling my application but that is a long shot.Thank you for the answer!
Szere Dyeri
An attacker could always bring your defenses down. The best security is the legal defense
ognian
fadden