Leem.fin
Leem.fin

Reputation: 42622

Java security file location in Android

In my computer, I can find the java security file under the following path:

jre/lib/security/java.security

Where does android store this file in Android 4.1 and above ? & Is it only accessible by rooted device?

==== UPDATE ====

In general, I need to know where does android maintain the list of security providers(e.g. AndroidOpenSSL, HarmonyJSSE, etc). I guess there should be a system file maintaining the list of those providers(like the file jre/lib/security/java.security in my computer).

Where is that file located? I know I can use Security class to get the list, but I need to know the location of the file in Android.

(The reason why I want to know the location of that file in android is that I would like to change the order of the providers.)

Upvotes: 2

Views: 1615

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006984

Where does android store this file in Android 4.0 and above ?

Android 6.0 does not use that file, and I doubt that prior versions of Android do either.

But there must be a file maintain the list of security providers

There must be a list of security providers. This list does not have to be maintained in a text file.

I tried the code Security.getProviders() it does list all the providers in my Android device

If you read the source code to java.security.Security for Android 6.0.1 r16, you will see that there are two possible sources of the provider list:

  1. The security.properties text baked into the libcore JAR as a JAR resource

  2. A hard-coded roster in the Security source code, if for some reason security.properties cannot be loaded

Note that older versions of Android may differ here, and device manufacturers/custom ROM developers may alter this further.

The reason why I want to know the location of that file in android is that I would like to change the order of the providers

At best, on a rooted device, you could try to hack a replacement security.properties into that JAR.

Upvotes: 3

Related Questions