Share via


Security.InsertProviderAt(Provider, Int32) Method

Definition

Adds a new provider, at a specified position.

[Android.Runtime.Register("insertProviderAt", "(Ljava/security/Provider;I)I", "")]
public static int InsertProviderAt (Java.Security.Provider? provider, int position);
[<Android.Runtime.Register("insertProviderAt", "(Ljava/security/Provider;I)I", "")>]
static member InsertProviderAt : Java.Security.Provider * int -> int

Parameters

provider
Provider

the provider to be added.

position
Int32

the preference position that the caller would like for this provider.

Returns

the actual preference position in which the provider was added, or -1 if the provider was not added because it is already installed.

Attributes

Remarks

Adds a new provider, at a specified position. The position is the preference order in which providers are searched for requested algorithms. The position is 1-based, that is, 1 is most preferred, followed by 2, and so on.

If the given provider is installed at the requested position, the provider that used to be at that position, and all providers with a position greater than position, are shifted up one position (towards the end of the list of installed providers).

A provider cannot be added if it is already installed.

If there is a security manager, the java.lang.SecurityManager#checkSecurityAccess method is called with the "insertProvider" permission target name to see if it's ok to add a new provider. If this permission check is denied, checkSecurityAccess is called again with the "insertProvider."+provider.getName() permission target name. If both checks are denied, a SecurityException is thrown.

Java documentation for java.security.Security.insertProviderAt(java.security.Provider, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to