SaslClient implementation for SCRAM-SHA-256, as specified in RFC 5802 and RFC 7677.
The IANA-registered mechanism was renamed to "MYSQLCJ-SCRAM-SHA-256" in order to avoid future conflicts with an officially supported implementation.
When there is a Java-supported implementation for SCRAM-SHA-256, it will have to be thoroughly tested with Connector/J and if that works, this code can be
obsoleted.
| Modifier and Type | Field and Description |
|---|---|
| private static final String | |
| public static final String | |
| public static final String | |
| private static final String | |
| private static final String | |
| private static final int |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv String | getIanaMechanismName()
Implements abstract com. Returns the real IANA-registered mechanism name of this SASL client. |
| public String | getMechanismName()
Implements javax. Returns the IANA-registered mechanism name of this SASL client. |
| pack-priv byte[] | Returns: the hash value of the given string.the string to hash. str)Implements abstract com. The "H(str)" cryptographic hash function as described in RFC 5802, Section 2.2 and RFC 7677, Section 3. |
| pack-priv byte[] | Returns: an hash value with an output length equal to the length of H(str).the string value to use as the internal HMAC key. str, byte[] the input string to hash in the initial iteration. salt, int the number of iterations to run the algorithm. iterations)Implements abstract com. The "Hi(str, salt, i)" PBKDF2 function as described in RFC 5802, Section 2.2 and RFC 7677, Section 3. |
| pack-priv byte[] | Returns: the hashed value of the given params.the hash key. key, byte[] the input string. str)Implements abstract com. The "HMAC(key, str)" HMAC keyed hash algorithm as described in RFC 5802, Section 2.2 and RFC 7677, Section 3. |
| HMAC_SHA256_ALGORITHM | back to summary |
|---|---|
| private static final String HMAC_SHA256_ALGORITHM | |
| IANA_MECHANISM_NAME | back to summary |
|---|---|
| public static final String IANA_MECHANISM_NAME | |
| MECHANISM_NAME | back to summary |
|---|---|
| public static final String MECHANISM_NAME | |
| PBKCF2_HMAC_SHA256_ALGORITHM | back to summary |
|---|---|
| private static final String PBKCF2_HMAC_SHA256_ALGORITHM | |
| SHA256_ALGORITHM | back to summary |
|---|---|
| private static final String SHA256_ALGORITHM | |
| SHA256_HASH_LENGTH | back to summary |
|---|---|
| private static final int SHA256_HASH_LENGTH | |
| ScramSha256SaslClient | back to summary |
|---|---|
| public ScramSha256SaslClient(String authorizationId, String authenticationId, String password) throws SaslException | |
| getIanaMechanismName | back to summary |
|---|---|
| pack-priv String getIanaMechanismName() Implements abstract com. Doc from com. Returns the real IANA-registered mechanism name of this SASL client. This is the same as | |
| getMechanismName | back to summary |
|---|---|
| public String getMechanismName() Implements javax. Doc from javax. Returns the IANA-registered mechanism name of this SASL client. (e.g. "CRAM-MD5", "GSSAPI"). | |
| h | back to summary |
|---|---|
| pack-priv byte[] h(byte[] str) Implements abstract com. The "H(str)" cryptographic hash function as described in RFC 5802, Section 2.2 and RFC 7677, Section 3. This implementation corresponds to SHA-256.
| |
| hi | back to summary |
|---|---|
| pack-priv byte[] hi(String str, byte[] salt, int iterations) Implements abstract com. The "Hi(str, salt, i)" PBKDF2 function as described in RFC 5802, Section 2.2 and RFC 7677, Section 3. This implementation corresponds to 'PBKDF2WithHmacSHA256'. | |
| hmac | back to summary |
|---|---|
| pack-priv byte[] hmac(byte[] key, byte[] str) Implements abstract com. The "HMAC(key, str)" HMAC keyed hash algorithm as described in RFC 5802, Section 2.2 and RFC 7677, Section 3. This implementation corresponds to 'HmacSHA256'.
| |