How to get imei in native code using C and C++ and without use of JAVA and JNI.

719 views
Skip to first unread message

Dharmendra Carpenter

unread,
Apr 24, 2018, 11:56:54 AM4/24/18
to android-ndk
Hi,

    How to get imei in native code using C and C++ and without use of TelephoneManger API and JNI Functions. Can anyone help me on this?

Thanks 
Dharmendra

Glenn Kasten

unread,
Apr 24, 2018, 12:02:02 PM4/24/18
to android-ndk
I'm curious why you can't use JNI, as that is the standard way to access APIs that don't have an NDK equivalent.
Message has been deleted

Dharmendra Carpenter

unread,
Apr 24, 2018, 2:23:40 PM4/24/18
to android-ndk
Thanks!! Glenn Kasten

We can use JNI but one of the security audit companies has recommended to get IMEI using native C/C++. They think that IMEI can be compromised while trying to retrieve it using Java and JNI

mic _

unread,
Apr 24, 2018, 2:57:09 PM4/24/18
to andro...@googlegroups.com
If you're worried about IMEI being spoofed you may want to look into ID attestation which is supported on some devices running Android 8.0 and later: https://source.android.com/security/keystore/attestation#id-attestation
Note that you'll need a server if you want to perform the validation in a secure manner.

/Michael

On Tue, Apr 24, 2018 at 8:23 PM, Dharmendra Carpenter <dharmen0...@gmail.com> wrote:
Thanks!! Glenn Kasten

We can use JNI but one of the security audit companies has recommended to get IMEI using native C/C++. They think that IMEI can be compromised while trying to retrieve it using Java and JNI

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk+unsubscribe@googlegroups.com.
To post to this group, send email to andro...@googlegroups.com.
Visit this group at https://groups.google.com/group/android-ndk.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/c5f18abf-dea4-4289-b744-77ce761b75fb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alex Cohn

unread,
Apr 25, 2018, 4:32:26 AM4/25/18
to android-ndk
On Tuesday, April 24, 2018 at 9:23:40 PM UTC+3, Dharmendra Carpenter wrote:
Thanks!! Glenn Kasten

We can use JNI but one of the security audit companies has recommended to get IMEI using native C/C++. They think that IMEI can be compromised while trying to retrieve it using Java and JNI

This security audit company wants you to use some hacks that can be more dangerous than IMEI being compromised while trying to retrieve it using Java. At any rate, there is no way to protect your function that reads IMEI from changed IMEI (consciously by the user or as a result of hacker attack).

Best regards,
Alex Cohn
Reply all
Reply to author
Forward
0 new messages