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

public abstract Class SimpleTrustManagerFactory

extends TrustManagerFactory
Class Inheritance
Known Direct Subclasses
io.netty5.handler.ssl.util.TrustManagerFactoryWrapper, io.netty5.handler.ssl.util.FingerprintTrustManagerFactory, io.netty5.handler.ssl.util.InsecureTrustManagerFactory
Imports
io.netty5.util.concurrent.FastThreadLocal, javax.net.ssl.ManagerFactoryParameters, .TrustManager, .TrustManagerFactory, .TrustManagerFactorySpi, .X509ExtendedTrustManager, .X509TrustManager, java.security.InvalidAlgorithmParameterException, .KeyStore, .KeyStoreException, .Provider

Helps to implement a custom TrustManagerFactory.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
private static final FastThreadLocal<SimpleTrustManagerFactory.SimpleTrustManagerFactorySpi>
CURRENT_SPI

SimpleTrustManagerFactorySpi must have a reference to SimpleTrustManagerFactory to delegate its callbacks back to SimpleTrustManagerFactory.

private static final Provider

Constructor Summary

AccessConstructor and Description
protected
SimpleTrustManagerFactory()

Creates a new instance.

protected
SimpleTrustManagerFactory(String
the name of this TrustManagerFactory
name
)

Creates a new instance.

Method Summary

Modifier and TypeMethod and Description
protected abstract TrustManager[]
engineGetTrustManagers()

Returns one trust manager for each type of trust material.

protected abstract void
engineInit(KeyStore keyStore)

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

protected abstract void
engineInit(ManagerFactoryParameters managerFactoryParameters)

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

Inherited from javax.net.ssl.TrustManagerFactory:
getAlgorithmgetDefaultAlgorithmgetInstancegetInstancegetInstancegetProvidergetTrustManagersinitinit

Field Detail

CURRENT_SPIback to summary
private static final FastThreadLocal<SimpleTrustManagerFactory.SimpleTrustManagerFactorySpi> CURRENT_SPI

SimpleTrustManagerFactorySpi must have a reference to SimpleTrustManagerFactory to delegate its callbacks back to SimpleTrustManagerFactory. However, it is impossible to do so, because TrustManagerFactory requires TrustManagerFactorySpi 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 ThreadLocal.

PROVIDERback to summary
private static final Provider PROVIDER

Constructor Detail

SimpleTrustManagerFactoryback to summary
protected SimpleTrustManagerFactory()

Creates a new instance.

SimpleTrustManagerFactoryback to summary
protected SimpleTrustManagerFactory(String name)

Creates a new instance.

Parameters
name:String

the name of this TrustManagerFactory

Method Detail

engineGetTrustManagersback to summary
protected abstract TrustManager[] engineGetTrustManagers()

Returns one trust manager for each type of trust material.

See Also
TrustManagerFactorySpi#engineGetTrustManagers()
engineInitback to summary
protected abstract void engineInit(KeyStore keyStore) throws Exception

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

See Also
TrustManagerFactorySpi#engineInit(KeyStore)
engineInitback to summary
protected abstract void engineInit(ManagerFactoryParameters managerFactoryParameters) throws Exception

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

See Also
TrustManagerFactorySpi#engineInit(ManagerFactoryParameters)
io.netty5.handler.ssl.util back to summary

pack-priv final Class SimpleTrustManagerFactory.SimpleTrustManagerFactorySpi

extends TrustManagerFactorySpi
Class Inheritance

Field Summary

Modifier and TypeField and Description
private SimpleTrustManagerFactory
private volatile TrustManager[]

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
protected TrustManager[]
engineGetTrustManagers()

Implements abstract javax.net.ssl.TrustManagerFactorySpi.engineGetTrustManagers.

Returns one trust manager for each type of trust material.
protected void
engineInit(KeyStore
the key store or null
keyStore
)

Implements abstract javax.net.ssl.TrustManagerFactorySpi.engineInit.

Initializes this factory with a source of certificate authorities and related trust material.
protected void
engineInit(ManagerFactoryParameters
an implementation of a provider-specific parameter specification
managerFactoryParameters
)

Implements abstract javax.net.ssl.TrustManagerFactorySpi.engineInit.

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

Field Detail

parentback to summary
private SimpleTrustManagerFactory parent
trustManagersback to summary
private volatile TrustManager[] trustManagers

Constructor Detail

SimpleTrustManagerFactorySpiback to summary
pack-priv SimpleTrustManagerFactorySpi()

Method Detail

engineGetTrustManagersback to summary
protected TrustManager[] engineGetTrustManagers()

Implements abstract javax.net.ssl.TrustManagerFactorySpi.engineGetTrustManagers.

Doc from javax.net.ssl.TrustManagerFactorySpi.engineGetTrustManagers.

Returns one trust manager for each type of trust material.

Returns:TrustManager[]

the trust managers

Annotations
@Override
engineInitback to summary
protected void engineInit(KeyStore keyStore) throws KeyStoreException

Implements abstract javax.net.ssl.TrustManagerFactorySpi.engineInit.

Doc from javax.net.ssl.TrustManagerFactorySpi.engineInit.

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

Parameters
keyStore:KeyStore

the key store or null

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

Implements abstract javax.net.ssl.TrustManagerFactorySpi.engineInit.

Doc from javax.net.ssl.TrustManagerFactorySpi.engineInit.

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.

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(SimpleTrustManagerFactory parent)