# TrustManagerFactorySpi

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Ctors](https://developer.android.com/reference/javax/net/ssl/TrustManagerFactorySpi#pubctors)\|[Protected Methods](https://developer.android.com/reference/javax/net/ssl/TrustManagerFactorySpi#promethods)\|[Inherited Methods](https://developer.android.com/reference/javax/net/ssl/TrustManagerFactorySpi#inhmethods)  

# TrustManagerFactorySpi

`
public


abstract
class
TrustManagerFactorySpi
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


`

|---|--------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | javax.net.ssl.TrustManagerFactorySpi |

<br />

*** ** * ** ***

This class defines the*Service Provider Interface* (**SPI** ) for the`TrustManagerFactory`class.

All the abstract methods in this class must be implemented by each cryptographic service provider who wishes to supply the implementation of a particular trust manager factory.  
**See also:**

- [TrustManagerFactory](https://developer.android.com/reference/javax/net/ssl/TrustManagerFactory)
- [TrustManager](https://developer.android.com/reference/javax/net/ssl/TrustManager)

## Summary

|                                                          ### Public constructors                                                           ||
|-----------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[TrustManagerFactorySpi](https://developer.android.com/reference/javax/net/ssl/TrustManagerFactorySpi#TrustManagerFactorySpi())`() ` |

|                                                                                                                                                                                                               ### Protected methods                                                                                                                                                                                                                ||
|--------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` abstract `[TrustManager[]](https://developer.android.com/reference/javax/net/ssl/TrustManager) | ` `[engineGetTrustManagers](https://developer.android.com/reference/javax/net/ssl/TrustManagerFactorySpi#engineGetTrustManagers())`() ` Returns one trust manager for each type of trust material.                                                                                                                                               |
| ` abstract void`                                                                                 | ` `[engineInit](https://developer.android.com/reference/javax/net/ssl/TrustManagerFactorySpi#engineInit(java.security.KeyStore))`(`[KeyStore](https://developer.android.com/reference/java/security/KeyStore)` ks) ` Initializes this factory with a source of certificate authorities and related trust material.                               |
| ` abstract void`                                                                                 | ` `[engineInit](https://developer.android.com/reference/javax/net/ssl/TrustManagerFactorySpi#engineInit(javax.net.ssl.ManagerFactoryParameters))`(`[ManagerFactoryParameters](https://developer.android.com/reference/javax/net/ssl/ManagerFactoryParameters)` spec) ` Initializes this factory with a source of provider-specific key material. |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||

## Public constructors

### TrustManagerFactorySpi

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public TrustManagerFactorySpi ()
```

<br />

<br />

## Protected methods

### engineGetTrustManagers

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
protected abstract TrustManager[] engineGetTrustManagers ()
```

Returns one trust manager for each type of trust material.

<br />

|                                                     Returns                                                     ||
|--------------------------------------------------------------------------------------|---------------------------|
| [TrustManager[]](https://developer.android.com/reference/javax/net/ssl/TrustManager) | the trust managers <br /> |

|                                                                Throws                                                                ||
|--------------------------------------------------------------------------------------------------|------------------------------------|
| [IllegalStateException](https://developer.android.com/reference/java/lang/IllegalStateException) | if the factory is not initialized. |

### engineInit

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
protected abstract void engineInit (KeyStore ks)
```

Initializes this factory with a source of certificate authorities and related trust material.

<br />

|                   Parameters                   ||
|------|------------------------------------------|
| `ks` | `KeyStore`: the key store or null <br /> |

|                                                        Throws                                                         ||
|----------------------------------------------------------------------------------------------|-------------------------|
| [KeyStoreException](https://developer.android.com/reference/java/security/KeyStoreException) | if this operation fails |

**See also:**

- [TrustManagerFactory.init(KeyStore)](https://developer.android.com/reference/javax/net/ssl/TrustManagerFactory#init(java.security.KeyStore))  

### engineInit

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
protected abstract void engineInit (ManagerFactoryParameters spec)
```

Initializes this factory with a source of provider-specific key material.

In some cases, initialization parameters other than a keystore may be needed by a provider. Users of that particular provider are expected to pass an implementation of the appropriate`ManagerFactoryParameters`as defined by the provider. The provider can then call the specified methods in the`ManagerFactoryParameters`implementation to obtain the needed information.

<br />

|                                                 Parameters                                                  ||
|--------|-----------------------------------------------------------------------------------------------------|
| `spec` | `ManagerFactoryParameters`: an implementation of a provider-specific parameter specification <br /> |

|                                                                                 Throws                                                                                  ||
|--------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------|
| [InvalidAlgorithmParameterException](https://developer.android.com/reference/java/security/InvalidAlgorithmParameterException) | if there is problem with the parameters |

**See also:**

- [TrustManagerFactory.init(ManagerFactoryParameters)](https://developer.android.com/reference/javax/net/ssl/TrustManagerFactory#init(javax.net.ssl.ManagerFactoryParameters))