Package org.jivesoftware.openfire.sasl
Class ScramSha256SaslServer
java.lang.Object
org.jivesoftware.openfire.sasl.ScramSaslServer
org.jivesoftware.openfire.sasl.ScramSha256SaslServer
- All Implemented Interfaces:
SaslServer
Implements the SCRAM-SHA-256 (and its channel binding -PLUS variant) server-side mechanism.
The SCRAM exchange itself is implemented by the hash-agnostic
ScramSaslServer superclass. This class binds
that exchange to the SHA-256 hash function.
As described in ScramSaslServer, instances are session-specific and must not be reused across sessions or
users. In particular, the instance must retain the mechanism availability for its session when processing GS2
channel-binding negotiation.- Author:
- Guus der Kinderen
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe JCA name of the message digest that corresponds to this mechanism's hash function.static final StringThe JCA name of the HMAC algorithm that corresponds to this mechanism's hash functionstatic final SystemProperty<Integer>static final StringThe IANA-registered name of the base (non-PLUS) mechanism implemented by this server.Fields inherited from class org.jivesoftware.openfire.sasl.ScramSaslServer
PROPNAME_CHANNELBINDINGTYPE -
Constructor Summary
ConstructorsConstructorDescriptionScramSha256SaslServer(boolean isPlusMechanism, Map<String, ?> props, Set<String> availableMechanismsForSession) Creates a new, client-specific, instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected intThe iteration count to advertise when no per-user value is available.protected StringThe JCA name of the message digest that corresponds to this mechanism's hash function, for exampleSHA-1.protected StringThe JCA name of the HMAC algorithm that corresponds to this mechanism's hash function, for exampleHmacSHA1.protected StringThe IANA-registered name of the base (non-PLUS) mechanism implemented by this server, for exampleSCRAM-SHA-1.protected StringA server-side secret from which deterministic fake credentials are derived for non-existent users, so that authentication processing for non-existing users is indistinguishable from that of existing users.static StringRetrieves a server-side secret used when handling authentication attempts for non-existing users in SCRAM-SHA-256 (-PLUS).Methods inherited from class org.jivesoftware.openfire.sasl.ScramSaslServer
dispose, evaluateResponse, extractRawGS2Header, getAuthorizationID, getMechanismName, getNegotiatedProperty, getOrCreateSalt, getOrFakeServerKey, getOrFakeStoredKey, isComplete, unwrap, wrap
-
Field Details
-
MECHANISM_NAME
The IANA-registered name of the base (non-PLUS) mechanism implemented by this server.- See Also:
-
HMAC_ALGORITHM_NAME
The JCA name of the HMAC algorithm that corresponds to this mechanism's hash function- See Also:
-
DIGEST_ALGORITHM_NAME
The JCA name of the message digest that corresponds to this mechanism's hash function.- See Also:
-
ITERATION_COUNT
-
-
Constructor Details
-
ScramSha256SaslServer
public ScramSha256SaslServer(boolean isPlusMechanism, Map<String, ?> props, @Nonnull Set<String> availableMechanismsForSession) Creates a new, client-specific, instance.- Parameters:
isPlusMechanism- Denotes if this instance supports channel-binding (true) or not (false).props- The possibly null set of properties used to select the SASL mechanism and to configure the authentication exchange of the selected mechanism.availableMechanismsForSession- The names of SASL mechanisms that are available to this particular session (as opposed to the set of globally available mechanism names).
-
-
Method Details
-
getServerSecretForNonExistentUsers
Retrieves a server-side secret used when handling authentication attempts for non-existing users in SCRAM-SHA-256 (-PLUS). This method ensures that the one-time initialization that is required for usage will occur. Instead of failing immediately, the server derives deterministic, fake SCRAM credentials (such as stored keys, server keys, and where applicable salt values) based on this secret. This ensures that authentication processing for non-existing users is indistinguishable from that of existing users. This mechanism helps protect against user enumeration attacks by preventing observable differences in behavior between existing and non-existing accounts. Changing (rotating) this value will cause different derived values to be generated for non-existing users. This does not affect authentication of existing users but can invalidate consistency of ongoing or repeated authentication attempts for non-existing users. -
getMechanismBaseName
Description copied from class:ScramSaslServerThe IANA-registered name of the base (non-PLUS) mechanism implemented by this server, for exampleSCRAM-SHA-1. This value is also the key under which SCRAM credentials for this mechanism are stored: the -PLUS variant shares the credential of the base mechanism.- Specified by:
getMechanismBaseNamein classScramSaslServer- Returns:
- A non-null string representing the IANA-registered (base) mechanism name.
-
getHmacAlgorithmName
Description copied from class:ScramSaslServerThe JCA name of the HMAC algorithm that corresponds to this mechanism's hash function, for exampleHmacSHA1.- Specified by:
getHmacAlgorithmNamein classScramSaslServer- Returns:
- the HMAC algorithm name.
-
getDigestAlgorithmName
Description copied from class:ScramSaslServerThe JCA name of the message digest that corresponds to this mechanism's hash function, for exampleSHA-1. Used to computeH(ClientKey)when verifying the client proof.- Specified by:
getDigestAlgorithmNamein classScramSaslServer- Returns:
- the message digest algorithm name.
-
getDefaultIterationCount
protected int getDefaultIterationCount()Description copied from class:ScramSaslServerThe iteration count to advertise when no per-user value is available.- Specified by:
getDefaultIterationCountin classScramSaslServer- Returns:
- the default iteration count for this mechanism.
-
getNonExistentUserSecret
Description copied from class:ScramSaslServerA server-side secret from which deterministic fake credentials are derived for non-existent users, so that authentication processing for non-existing users is indistinguishable from that of existing users.- Specified by:
getNonExistentUserSecretin classScramSaslServer- Returns:
- the server secret for this mechanism.
- See Also:
-