Package org.apache.zookeeper.util.scram
Class ScramFormatter
java.lang.Object
org.apache.zookeeper.util.scram.ScramFormatter
SCRAM-SHA-256 primitives per RFC 5802/7677: Hi (PBKDF2), the key/signature
derivations and the saslname escaping. Only FIPS-approved algorithms are
involved (SHA-256, HMAC-SHA-256, PBKDF2).
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic StringauthMessage(String clientFirstBare, String serverFirst, String clientFinalWithoutProof) static byte[]clientKey(byte[] saltedPassword) static byte[]h(byte[] data) static byte[]hi(char[] password, byte[] salt, int iterations) Hi(str, salt, i) from RFC 5802, which is PBKDF2-HMAC-SHA-256.static byte[]hmac(byte[] key, byte[] data) static StringEscapes a username into an RFC 5802 saslname: '=' as "=3D", ',' as "=2C".static Stringstatic byte[]static byte[]serverKey(byte[] saltedPassword) static byte[]storedKey(byte[] clientKey) static StringReversessaslName(String); rejects any other use of '='.static byte[]xor(byte[] first, byte[] second)
-
Field Details
-
MECHANISM
- See Also:
-
-
Method Details
-
h
- Throws:
SaslException
-
hmac
- Throws:
SaslException
-
hi
Hi(str, salt, i) from RFC 5802, which is PBKDF2-HMAC-SHA-256.- Throws:
SaslException
-
clientKey
- Throws:
SaslException
-
serverKey
- Throws:
SaslException
-
storedKey
- Throws:
SaslException
-
xor
- Throws:
SaslException
-
authMessage
-
saslName
Escapes a username into an RFC 5802 saslname: '=' as "=3D", ',' as "=2C". -
username
ReversessaslName(String); rejects any other use of '='.- Throws:
SaslException
-
secureRandomNonce
-
secureRandomSalt
public static byte[] secureRandomSalt()
-