Class DigestUtil
java.lang.Object
org.wildfly.security.sasl.digest._private.DigestUtil
- Author:
- Peter Skopek.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]computeHMAC(byte[] kc, int sequenceNumber, Mac mac, byte[] message, int offset, int len) static byte[]convertToHexBytesWithLeftPadding(int input, int totalLength) Converts input to HEX and pad it from left with zeros to totalLength.static SecretKeycreate3desSecretKey(byte[] keyBits) Create 3des secret key according to http://www.cryptosys.net/3des.html.static SecretKeycreateDesSecretKey(byte[] keyBits) Create DES secret key according to http://www.cryptosys.net/3des.html.static intdecodeByteOrderedInteger(byte[] buf, int offset, int len) static byte[]digestResponse(MessageDigest messageDigest, byte[] H_A1, byte[] nonce, int nonce_count, byte[] cnonce, String authzid, String qop, String digest_uri, boolean auth) Method to produce digest-response: response-value = HEX( KD ( HEX(H(A1)), { nonce-value, ":" nc-value, ":", cnonce-value, ":", qop-value, ":", HEX(H(A2)) }))static byte[]H_A1(MessageDigest messageDigest, byte[] digest_urp, byte[] nonce, byte[] cnonce, String authzid, Charset responseCharset) Calculates H(A1).static voidintegerByteOrdered(int num, byte[] buf, int offset, int len) static StringmessageDigestAlgorithm(String digestAlgorithm) static StringpasswordAlgorithm(String digestAlgorithm)
-
Field Details
-
QOP_AUTH
- See Also:
-
QOP_AUTH_INT
- See Also:
-
QOP_AUTH_CONF
- See Also:
-
QOP_VALUES
-
AUTH_METHOD
- See Also:
-
SECURITY_MARK
- See Also:
-
HASH_algorithm
- See Also:
-
HMAC_algorithm
- See Also:
-
-
Constructor Details
-
DigestUtil
public DigestUtil()
-
-
Method Details
-
passwordAlgorithm
-
messageDigestAlgorithm
-
H_A1
public static byte[] H_A1(MessageDigest messageDigest, byte[] digest_urp, byte[] nonce, byte[] cnonce, String authzid, Charset responseCharset) Calculates H(A1).- Parameters:
messageDigest-digest_urp-nonce-cnonce-authzid-responseCharset-- Returns:
-
digestResponse
public static byte[] digestResponse(MessageDigest messageDigest, byte[] H_A1, byte[] nonce, int nonce_count, byte[] cnonce, String authzid, String qop, String digest_uri, boolean auth) Method to produce digest-response: response-value = HEX( KD ( HEX(H(A1)), { nonce-value, ":" nc-value, ":", cnonce-value, ":", qop-value, ":", HEX(H(A2)) })) -
convertToHexBytesWithLeftPadding
public static byte[] convertToHexBytesWithLeftPadding(int input, int totalLength) Converts input to HEX and pad it from left with zeros to totalLength.- Parameters:
input- to be converted to HEXtotalLength- length of returned array of bytes- Returns:
-
computeHMAC
public static byte[] computeHMAC(byte[] kc, int sequenceNumber, Mac mac, byte[] message, int offset, int len) throws SaslException - Throws:
SaslException
-
integerByteOrdered
public static void integerByteOrdered(int num, byte[] buf, int offset, int len) -
decodeByteOrderedInteger
public static int decodeByteOrderedInteger(byte[] buf, int offset, int len) -
createDesSecretKey
public static SecretKey createDesSecretKey(byte[] keyBits) throws NoSuchAlgorithmException, InvalidKeyException, InvalidKeySpecException Create DES secret key according to http://www.cryptosys.net/3des.html.- Parameters:
keyBits-- Returns:
- Throws:
NoSuchAlgorithmExceptionInvalidKeyExceptionInvalidKeySpecException
-
create3desSecretKey
public static SecretKey create3desSecretKey(byte[] keyBits) throws NoSuchAlgorithmException, InvalidKeyException, InvalidKeySpecException Create 3des secret key according to http://www.cryptosys.net/3des.html.- Parameters:
keyBits-- Returns:
- Throws:
NoSuchAlgorithmExceptionInvalidKeyExceptionInvalidKeySpecException
-