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/KeyManagerFactorySpi#pubctors) \| [Protected Methods](https://developer.android.com/reference/javax/net/ssl/KeyManagerFactorySpi#promethods) \| [Inherited Methods](https://developer.android.com/reference/javax/net/ssl/KeyManagerFactorySpi#inhmethods)

# KeyManagerFactorySpi


`
public


abstract
class
KeyManagerFactorySpi
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


`

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

<br />

*** ** * ** ***

This class defines the *Service Provider Interface* (**SPI** )
for the `KeyManagerFactory` 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 key manager factory.
**See also:**

- `https://developer.android.com/reference/javax/net/ssl/KeyManagerFactory`
- `https://developer.android.com/reference/javax/net/ssl/KeyManager`

## Summary

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

| ### Protected methods ||
|---|---|
| ` abstract https://developer.android.com/reference/javax/net/ssl/KeyManager` | ` https://developer.android.com/reference/javax/net/ssl/KeyManagerFactorySpi#engineGetKeyManagers()() ` Returns one key manager for each type of key material. |
| ` abstract void` | ` https://developer.android.com/reference/javax/net/ssl/KeyManagerFactorySpi#engineInit(javax.net.ssl.ManagerFactoryParameters)(https://developer.android.com/reference/javax/net/ssl/ManagerFactoryParameters spec) ` Initializes this factory with a source of key material. |
| ` abstract void` | ` https://developer.android.com/reference/javax/net/ssl/KeyManagerFactorySpi#engineInit(java.security.KeyStore,%20char[])(https://developer.android.com/reference/java/security/KeyStore ks, char[] password) ` Initializes this factory with a source of key material. |

| ### Inherited methods |
|---|---|
| From class ` https://developer.android.com/reference/java/lang/Object ` |---|---| | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/lang/Object#clone()() ` Creates and returns a copy of this object. | | ` boolean` | ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Indicates whether some other object is "equal to" this one. | | ` void` | ` 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 https://developer.android.com/reference/java/lang/Class<?>` | ` https://developer.android.com/reference/java/lang/Object#getClass()() ` Returns the runtime class of this `Object`. | | ` int` | ` https://developer.android.com/reference/java/lang/Object#hashCode()() ` Returns a hash code value for the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notify()() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notifyAll()() ` Wakes up all threads that are waiting on this object's monitor. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/lang/Object#toString()() ` Returns a string representation of the object. | | ` final void` | ` 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` | ` 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` | ` 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

### KeyManagerFactorySpi

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

```
public KeyManagerFactorySpi ()
```

<br />

<br />

## Protected methods

### engineGetKeyManagers

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

```
protected abstract KeyManager[] engineGetKeyManagers ()
```

Returns one key manager for each type of key material.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/javax/net/ssl/KeyManager` | the key managers <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException` | if the KeyManagerFactorySpi is not initialized |

### 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 key material.


In some cases, initialization parameters other than a keystore
and password 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 ||
|---|---|
| `https://developer.android.com/reference/java/security/InvalidAlgorithmParameterException` | if there is problem with the parameters |

**See also:**

- `https://developer.android.com/reference/javax/net/ssl/KeyManagerFactory#init(javax.net.ssl.ManagerFactoryParameters)`

### engineInit

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

```
protected abstract void engineInit (KeyStore ks, 
                char[] password)
```

Initializes this factory with a source of key material.

<br />

| Parameters ||
|---|---|
| `ks` | `KeyStore`: the key store or null <br /> |
| `password` | `char`: the password for recovering keys <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/security/KeyStoreException` | if this operation fails |
| `https://developer.android.com/reference/java/security/NoSuchAlgorithmException` | if the specified algorithm is not available from the specified provider. |
| `https://developer.android.com/reference/java/security/UnrecoverableKeyException` | if the key cannot be recovered |

**See also:**

- `https://developer.android.com/reference/javax/net/ssl/KeyManagerFactory#init(java.security.KeyStore,%20char[])`