Top Description Inners Fields Constructors Methods
io.netty.handler.ssl.util

public abstract Class SimpleKeyManagerFactory

extends KeyManagerFactory
Class Inheritance
Known Direct Subclasses
io.netty.handler.ssl.util.KeyManagerFactoryWrapper
Imports
io.netty.util.concurrent.FastThreadLocal, io.netty.util.internal.ObjectUtil, .PlatformDependent, .StringUtil, .SuppressJava6Requirement, java.security.InvalidAlgorithmParameterException, .KeyStore, .KeyStoreException, .Provider, javax.net.ssl.ManagerFactoryParameters, .KeyManager, .KeyManagerFactory, .KeyManagerFactorySpi, .X509ExtendedKeyManager, .X509KeyManager

Helps to implement a custom KeyManagerFactory.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private static final FastThreadLocal<SimpleKeyManagerFactory.SimpleKeyManagerFactorySpi>
CURRENT_SPI

SimpleKeyManagerFactorySpi must have a reference to SimpleKeyManagerFactory to delegate its callbacks back to SimpleKeyManagerFactory.

private static final Provider

Constructor Summary

AccessConstructor and Description
protected
SimpleKeyManagerFactory()

Creates a new instance.

protected
SimpleKeyManagerFactory(String
the name of this KeyManagerFactory
name
)

Creates a new instance.

Method Summary

Modifier and TypeMethod and Description
protected abstract KeyManager[]
engineGetKeyManagers()

Returns one key manager for each type of key material.

protected abstract void
engineInit(KeyStore keyStore, char[] var2)

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

protected abstract void
engineInit(ManagerFactoryParameters managerFactoryParameters)

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

Inherited from javax.net.ssl.KeyManagerFactory:
getAlgorithmgetDefaultAlgorithmgetInstancegetInstancegetInstancegetKeyManagersgetProviderinitinit

Field Detail

CURRENT_SPIback to summary
private static final FastThreadLocal<SimpleKeyManagerFactory.SimpleKeyManagerFactorySpi> CURRENT_SPI

SimpleKeyManagerFactorySpi must have a reference to SimpleKeyManagerFactory to delegate its callbacks back to SimpleKeyManagerFactory. However, it is impossible to do so, because KeyManagerFactory requires KeyManagerFactorySpi at construction time and does not provide a way to access it later. To work around this issue, we use an ugly hack which uses a FastThreadLocal.

PROVIDERback to summary
private static final Provider PROVIDER

Constructor Detail

SimpleKeyManagerFactoryback to summary
protected SimpleKeyManagerFactory()

Creates a new instance.

SimpleKeyManagerFactoryback to summary
protected SimpleKeyManagerFactory(String name)

Creates a new instance.

Parameters
name:String

the name of this KeyManagerFactory

Method Detail

engineGetKeyManagersback to summary
protected abstract KeyManager[] engineGetKeyManagers()

Returns one key manager for each type of key material.

See Also
KeyManagerFactorySpi#engineGetKeyManagers()
engineInitback to summary
protected abstract void engineInit(KeyStore keyStore, char[] var2) throws Exception

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

See Also
KeyManagerFactorySpi#engineInit(KeyStore, char[])
engineInitback to summary
protected abstract void engineInit(ManagerFactoryParameters managerFactoryParameters) throws Exception

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

See Also
KeyManagerFactorySpi#engineInit(ManagerFactoryParameters)
io.netty.handler.ssl.util back to summary

private final Class SimpleKeyManagerFactory.SimpleKeyManagerFactorySpi

extends KeyManagerFactorySpi
Class Inheritance

Field Summary

Modifier and TypeField and Description
private volatile KeyManager[]
private SimpleKeyManagerFactory

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
protected KeyManager[]
engineGetKeyManagers()

Implements abstract javax.net.ssl.KeyManagerFactorySpi.engineGetKeyManagers.

Returns one key manager for each type of key material.
protected void
engineInit(KeyStore
the key store or null
keyStore
,
char[]
the password for recovering keys
pwd
)

Implements abstract javax.net.ssl.KeyManagerFactorySpi.engineInit.

Initializes this factory with a source of key material.
protected void
engineInit(ManagerFactoryParameters
an implementation of a provider-specific parameter specification
managerFactoryParameters
)

Implements abstract javax.net.ssl.KeyManagerFactorySpi.engineInit.

Initializes this factory with a source of key material.
pack-priv void
private static void
wrapIfNeeded(KeyManager[] keyManagers)

Field Detail

keyManagersback to summary
private volatile KeyManager[] keyManagers
parentback to summary
private SimpleKeyManagerFactory parent

Constructor Detail

SimpleKeyManagerFactorySpiback to summary
private SimpleKeyManagerFactorySpi()

Method Detail

engineGetKeyManagersback to summary
protected KeyManager[] engineGetKeyManagers()

Implements abstract javax.net.ssl.KeyManagerFactorySpi.engineGetKeyManagers.

Doc from javax.net.ssl.KeyManagerFactorySpi.engineGetKeyManagers.

Returns one key manager for each type of key material.

Returns:KeyManager[]

the key managers

Annotations
@Override
engineInitback to summary
protected void engineInit(KeyStore keyStore, char[] pwd) throws KeyStoreException

Implements abstract javax.net.ssl.KeyManagerFactorySpi.engineInit.

Doc from javax.net.ssl.KeyManagerFactorySpi.engineInit.

Initializes this factory with a source of key material.

Parameters
keyStore:KeyStore

the key store or null

pwd:char[]

the password for recovering keys

Annotations
@Override
Exceptions
KeyStoreException:
if this operation fails
engineInitback to summary
protected void engineInit(ManagerFactoryParameters managerFactoryParameters) throws InvalidAlgorithmParameterException

Implements abstract javax.net.ssl.KeyManagerFactorySpi.engineInit.

Doc from javax.net.ssl.KeyManagerFactorySpi.engineInit.

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.

Parameters
managerFactoryParameters:ManagerFactoryParameters

an implementation of a provider-specific parameter specification

Annotations
@Override
Exceptions
InvalidAlgorithmParameterException:
if there is problem with the parameters
initback to summary
pack-priv void init(SimpleKeyManagerFactory parent)
wrapIfNeededback to summary
private static void wrapIfNeeded(KeyManager[] keyManagers)
Annotations
@SuppressJava6Requirement
reason:Usage guarded by java version check