Top Fields Methods
org.apache.sshd.common.util.security

public Interface SecurityProviderRegistrar

extends SecurityProviderChoice, OptionalFeature, PropertyResolver
Known Direct Implementers
org.apache.sshd.common.util.security.AbstractSecurityProviderRegistrar
Imports
java.security.KeyFactory, .KeyPairGenerator, .MessageDigest, .Provider, .Security, .Signature, java.security.cert.CertificateFactory, java.util.Arrays, .Collection, .Collections, .List, .Map, .Objects, .Optional, java.util.function.Predicate, javax.crypto.Cipher, .KeyAgreement, .Mac, org.apache.sshd.common.OptionalFeature, .PropertyResolver, .PropertyResolverUtils, .SyspropsMapWrapper, org.apache.sshd.common.util.GenericUtils, .IgnoringEmptyMap, .ValidateUtils, org.apache.sshd.common.util.security.eddsa.generic.EdDSASupport

Author
Apache MINA SSHD Project

Field Summary

Modifier and TypeField and Description
public static final String
public static final String
public static final String
CONFIG_PROP_BASE

Base name for configuration properties related to security providers

public static final String
ENABLED_PROPERTY

Property used to configure whether the provider is enabled regardless of whether it is supported.

public static final String
NAMED_PROVIDER_PROPERTY

Property used to configure whether to use the provider's name rather than its Provider instance

public static final String
public static final List<Class<?>>
SECURITY_ENTITIES

All the entities that are used in calls to isSecurityEntitySupported(Class, String)

Inherited from org.apache.sshd.common.OptionalFeature:
FALSETRUE
Inherited from org.apache.sshd.common.PropertyResolver:
EMPTY
Inherited from org.apache.sshd.common.util.security.SecurityProviderChoice:
EMPTY

Method Summary

Modifier and TypeMethod and Description
public static SecurityProviderRegistrar
public default String
public default String
public default String

Returns:

Configuration value to use if no specific configuration provided - default=empty
getDefaultSecurityEntitySupportValue
(Class<?>
The requested entity type - its simple name serves to build the configuration property name.
entityType
)

public default Optional<EdDSASupport<?, ?>>

Returns:

the EdDSA support implementation associated with the security provider (if applicable)
getEdDSASupport
()

public static String

Returns:

The resolved name
getEffectiveSecurityEntityName
(Class<?>
The security entity type - ignored if null
entityType
,
String
The effective name - ignored if null/empty
name
)

Determines the "pure" security entity name - e.g., for Ciphers it strips the trailing transformation specification in order to extract the base cipher name - e.g., "AES/CBC/NoPadding" => "AES"

public default PropertyResolver
public default Map<String, Object>
getProperties()

Implements org.apache.sshd.common.PropertyResolver.getProperties.

A map of properties that can be used to configure the SSH server or client.

public static boolean

Returns:

true if the value equals (case insensitive) to either ALL_OPTIONS_VALUE or ALL_OPTIONS_WILDCARD
isAllOptionsValue
(String
Value to be examined
v
)

public default boolean

Returns:

true if this security provider supports the algorithm
isCertificateFactorySupported
(String type)

public default boolean

Returns:

true if this security provider supports the transformation
isCipherSupported
(String
The requested Cipher transformation
transformation
)

public default boolean

Returns:

true if the provider is enabled regardless of whether it is supported - default=true

Note

checks if the provider has been programmatically disabled via SecurityUtils#setAPrioriDisabledProvider(String, boolean)

isEnabled
()

public default boolean

Returns:

true if this security provider supports the algorithm
isKeyAgreementSupported
(String
The KeyAgreement algorithm
algorithm
)

public default boolean

Returns:

true if this security provider supports the algorithm
isKeyFactorySupported
(String
The KeyFactory algorithm
algorithm
)

public default boolean

Returns:

true if this security provider supports the algorithm
isKeyPairGeneratorSupported
(String
The KeyPairGenerator algorithm
algorithm
)

public default boolean

Returns:

true if this security provider supports the algorithm
isMacSupported
(String
The Mac algorithm
algorithm
)

public default boolean

Returns:

true if this security provider supports the algorithm
isMessageDigestSupported
(String
The MessageDigest algorithm
algorithm
)

public default boolean

Returns:

true if to use the provider's name rather than its Provider instance - default=true
isNamedProviderUsed
()

Overrides default org.apache.sshd.common.util.security.SecurityProviderChoice.isNamedProviderUsed.

public default boolean
isSecurityEntitySupported(Class<?> entityType, String name)

public static boolean

Returns:

true registrar is supported and the value is listed (case insensitive) or * the property is one of the "all" markers
isSecurityEntitySupported
(SecurityProviderRegistrar registrar, Class<?>
The requested entity type - its simple name serves to build the configuration property name.
entityType
,
String
The requested algorithm/name - Note: if the requested entity is a Cipher then the argument is assumed to be a possible "/" separated transformation and parsed as such in order to retrieve the pure cipher name
name
,
String
Configuration value to use if no specific configuration provided
defaultValue
)

Checks whether the requested entity type algorithm/name is listed as supported by the registrar's configuration

public static boolean
isSecurityEntitySupported(PropertyResolver resolver, String propName, Class<?> entityType, String name, String defaultValue)

public default boolean

Returns:

true if this security provider supports the algorithm
isSignatureSupported
(String
The Signature algorithm
algorithm
)

public static boolean

Returns:

true if no provider was previously registered
registerSecurityProvider
(SecurityProviderRegistrar registrar)

Attempts to register the security provider represented by the registrar if not already registered

Note

if SecurityProviderRegistrar#isNamedProviderUsed() is true then the generated provider will be added to the system's list of known providers.

Inherited from org.apache.sshd.common.OptionalFeature:
allanyisSupportedof
Inherited from org.apache.sshd.common.PropertyResolver:
getBooleangetBooleanPropertygetCharsetgetIntegergetIntPropertygetLonggetLongPropertygetObjectgetStringgetStringPropertyisEmptyisEmpty
Inherited from org.apache.sshd.common.util.security.SecurityProviderChoice:
createProviderInstancegetProviderNamegetSecurityProvidertoSecurityProviderChoicetoSecurityProviderChoice

Field Detail

ALL_OPTIONS_VALUEback to summary
public static final String ALL_OPTIONS_VALUE
ALL_OPTIONS_WILDCARDback to summary
public static final String ALL_OPTIONS_WILDCARD
CONFIG_PROP_BASEback to summary
public static final String CONFIG_PROP_BASE

Base name for configuration properties related to security providers

ENABLED_PROPERTYback to summary
public static final String ENABLED_PROPERTY

Property used to configure whether the provider is enabled regardless of whether it is supported.

See Also
isEnabled()
NAMED_PROVIDER_PROPERTYback to summary
public static final String NAMED_PROVIDER_PROPERTY

Property used to configure whether to use the provider's name rather than its Provider instance

See Also
isNamedProviderUsed()
NO_OPTIONS_VALUEback to summary
public static final String NO_OPTIONS_VALUE
SECURITY_ENTITIESback to summary
public static final List<Class<?>> SECURITY_ENTITIES

All the entities that are used in calls to isSecurityEntitySupported(Class, String)

Method Detail

findSecurityProviderRegistrarBySecurityEntityback to summary
public static SecurityProviderRegistrar findSecurityProviderRegistrarBySecurityEntity(Predicate<? super SecurityProviderRegistrar> entitySelector, Collection<? extends SecurityProviderRegistrar> registrars)
getBasePropertyNameback to summary
public default String getBasePropertyName()
getConfigurationPropertyNameback to summary
public default String getConfigurationPropertyName(String name)
getDefaultSecurityEntitySupportValueback to summary
public default String getDefaultSecurityEntitySupportValue(Class<?> entityType)
Parameters
entityType:Class<?>

The requested entity type - its simple name serves to build the configuration property name.

Returns:String

Configuration value to use if no specific configuration provided - default=empty

See Also
isSecurityEntitySupported(Class, String)
getEdDSASupportback to summary
public default Optional<EdDSASupport<?, ?>> getEdDSASupport()
Returns:Optional<EdDSASupport<?, ?>>

the EdDSA support implementation associated with the security provider (if applicable)

getEffectiveSecurityEntityNameback to summary
public static String getEffectiveSecurityEntityName(Class<?> entityType, String name)

Determines the "pure" security entity name - e.g., for Ciphers it strips the trailing transformation specification in order to extract the base cipher name - e.g., "AES/CBC/NoPadding" => "AES"

Parameters
entityType:Class<?>

The security entity type - ignored if null

name:String

The effective name - ignored if null/empty

Returns:String

The resolved name

getParentPropertyResolverback to summary
public default PropertyResolver getParentPropertyResolver()

Implements org.apache.sshd.common.PropertyResolver.getParentPropertyResolver.

Returns:PropertyResolver

Doc from org.apache.sshd.common.PropertyResolver.getParentPropertyResolver.

The parent resolver that can be used to query for missing properties - null if no parent

Annotations
@Override
getPropertiesback to summary
public default Map<String, Object> getProperties()

Implements org.apache.sshd.common.PropertyResolver.getProperties.

Doc from org.apache.sshd.common.PropertyResolver.getProperties.

A map of properties that can be used to configure the SSH server or client. This map will never be changed by either the server or client and is not supposed to be changed at runtime (changes are not bound to have any effect on a running client or server), though it may affect the creation of sessions later as these values are usually not cached

Note

the type of the mapped property should match the expected configuration value type - Long, Integer, Boolean, String, etc.... If it doesn't, the toString() result of the mapped value is used to convert it to the required type. E.g., if the mapped value is the string "1234" and the expected value is a long then it will be parsed into one. Also, if the mapped value is an Integer but a long is expected, then it will be converted into one.

Returns:Map<String, Object>

a valid Map containing configuration values, never null

Note

may be immutable.

Annotations
@Override
isAllOptionsValueback to summary
public static boolean isAllOptionsValue(String v)
Parameters
v:String

Value to be examined

Returns:boolean

true if the value equals (case insensitive) to either ALL_OPTIONS_VALUE or ALL_OPTIONS_WILDCARD

isCertificateFactorySupportedback to summary
public default boolean isCertificateFactorySupported(String type)
Parameters
type:String

The CertificateFactory type

Returns:boolean

true if this security provider supports the algorithm

See Also
isSecurityEntitySupported(Class, String)
isCipherSupportedback to summary
public default boolean isCipherSupported(String transformation)
Parameters
transformation:String

The requested Cipher transformation

Returns:boolean

true if this security provider supports the transformation

See Also
isSecurityEntitySupported(Class, String)
isEnabledback to summary
public default boolean isEnabled()
Returns:boolean

true if the provider is enabled regardless of whether it is supported - default=true

Note

checks if the provider has been programmatically disabled via SecurityUtils#setAPrioriDisabledProvider(String, boolean)

See Also
ENABLED_PROPERTY
isKeyAgreementSupportedback to summary
public default boolean isKeyAgreementSupported(String algorithm)
Parameters
algorithm:String

The KeyAgreement algorithm

Returns:boolean

true if this security provider supports the algorithm

See Also
isSecurityEntitySupported(Class, String)
isKeyFactorySupportedback to summary
public default boolean isKeyFactorySupported(String algorithm)
Parameters
algorithm:String

The KeyFactory algorithm

Returns:boolean

true if this security provider supports the algorithm

See Also
isSecurityEntitySupported(Class, String)
isKeyPairGeneratorSupportedback to summary
public default boolean isKeyPairGeneratorSupported(String algorithm)
Parameters
algorithm:String

The KeyPairGenerator algorithm

Returns:boolean

true if this security provider supports the algorithm

See Also
isSecurityEntitySupported(Class, String)
isMacSupportedback to summary
public default boolean isMacSupported(String algorithm)
Parameters
algorithm:String

The Mac algorithm

Returns:boolean

true if this security provider supports the algorithm

See Also
isSecurityEntitySupported(Class, String)
isMessageDigestSupportedback to summary
public default boolean isMessageDigestSupported(String algorithm)
Parameters
algorithm:String

The MessageDigest algorithm

Returns:boolean

true if this security provider supports the algorithm

See Also
isSecurityEntitySupported(Class, String)
isNamedProviderUsedback to summary
public default boolean isNamedProviderUsed()

Overrides default org.apache.sshd.common.util.security.SecurityProviderChoice.isNamedProviderUsed.

Returns:boolean

true if to use the provider's name rather than its Provider instance - default=true

Annotations
@Override
See Also
NAMED_PROVIDER_PROPERTY, getSecurityProvider(), registerSecurityProvider(SecurityProviderRegistrar)
isSecurityEntitySupportedback to summary
public default boolean isSecurityEntitySupported(Class<?> entityType, String name)
isSecurityEntitySupportedback to summary
public static boolean isSecurityEntitySupported(SecurityProviderRegistrar registrar, Class<?> entityType, String name, String defaultValue)

Checks whether the requested entity type algorithm/name is listed as supported by the registrar's configuration

Parameters
registrar:SecurityProviderRegistrar

The SecurityProviderRegistrar

entityType:Class<?>

The requested entity type - its simple name serves to build the configuration property name.

name:String

The requested algorithm/name - Note: if the requested entity is a Cipher then the argument is assumed to be a possible "/" separated transformation and parsed as such in order to retrieve the pure cipher name

defaultValue:String

Configuration value to use if no specific configuration provided

Returns:boolean

true registrar is supported and the value is listed (case insensitive) or * the property is one of the "all" markers

See Also
SecurityProviderRegistrar#isSupported(), isAllOptionsValue(String)
isSecurityEntitySupportedback to summary
public static boolean isSecurityEntitySupported(PropertyResolver resolver, String propName, Class<?> entityType, String name, String defaultValue)
isSignatureSupportedback to summary
public default boolean isSignatureSupported(String algorithm)
Parameters
algorithm:String

The Signature algorithm

Returns:boolean

true if this security provider supports the algorithm

See Also
isSecurityEntitySupported(Class, String)
registerSecurityProviderback to summary
public static boolean registerSecurityProvider(SecurityProviderRegistrar registrar)

Attempts to register the security provider represented by the registrar if not already registered

Note

if SecurityProviderRegistrar#isNamedProviderUsed() is true then the generated provider will be added to the system's list of known providers.

Parameters
registrar:SecurityProviderRegistrar

The SecurityProviderRegistrar

Returns:boolean

true if no provider was previously registered

See Also
Security#getProvider(String), SecurityProviderRegistrar#getSecurityProvider(), Security#addProvider(Provider)