Package com.wowza.util
Class SHA256DigestUtils
- Object
-
- com.wowza.util.SHA256DigestUtils
-
public class SHA256DigestUtils extends Object
SHA256DigestUtils: SHA256 hash utilities.
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.security.MessageDigest
sha256Digest
protected static Object
sha256Lock
-
Constructor Summary
Constructors Constructor Description SHA256DigestUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
generateAuth(String method, String uri, String username, String password, String realm, String nonce)
Generate an HTTP authorization responsestatic String
generateAuth(String a2Hash, String a1Hash, String realm, String nonce, String qop, String nonceCount, String cnonce)
Generate an HTTP authorization responsestatic String
generateAuth(String method, String uri, String a1Hash, String realm, String nonce, String qop, String nonceCount, String cnonce)
Generate an HTTP authorization responsestatic String
generateAuth(String method, String uri, String username, String password, String realm, String nonce, String qop, String nonceCount, String cnonce)
Generate an HTTP authorization responsestatic String
generateAuthHTTP(String method, String uri, String a1Hash, String nonce, String qop, String nonceCount, String cnonce)
Generate an HTTP authorization responsestatic String
generateAuthHTTP(String method, String uri, String username, String password, String realm, String nonce, String qop, String nonceCount, String cnonce)
Generate an HTTP authorization responsestatic String
generateHash(String value)
Generate SHA256 hashstatic byte[]
generateHashBytes(byte[] value)
Generate SHA256 hashstatic byte[]
generateHashBytes(String value)
Generate SHA256 hashstatic boolean
validate(String storedPassword, String username, String realm, String password)
-
-
-
Method Detail
-
generateAuth
public static String generateAuth(String method, String uri, String username, String password, String realm, String nonce)
Generate an HTTP authorization response- Parameters:
method
- methoduri
- URIusername
- usernamepassword
- passwordrealm
- realmnonce
- nonce- Returns:
- auth response
-
generateAuth
public static String generateAuth(String method, String uri, String username, String password, String realm, String nonce, String qop, String nonceCount, String cnonce)
Generate an HTTP authorization response- Parameters:
method
- methoduri
- URIusername
- usernamepassword
- passwordrealm
- realmnonce
- nonceqop
- qopnonceCount
- nonceCountcnonce
- cnonce- Returns:
- auth response
-
generateAuthHTTP
public static String generateAuthHTTP(String method, String uri, String username, String password, String realm, String nonce, String qop, String nonceCount, String cnonce)
Generate an HTTP authorization response- Parameters:
method
- methoduri
- URIusername
- usernamepassword
- passwordrealm
- realmnonce
- nonceqop
- qopnonceCount
- nonceCountcnonce
- cnonce- Returns:
- response
-
generateAuthHTTP
public static String generateAuthHTTP(String method, String uri, String a1Hash, String nonce, String qop, String nonceCount, String cnonce)
Generate an HTTP authorization response- Parameters:
method
- The HTTP methoduri
- The URIa1Hash
- The a1 hashnonce
- nonceqop
- qopnonceCount
- nonceCountcnonce
- cnonce- Returns:
- response
-
generateAuth
public static String generateAuth(String method, String uri, String a1Hash, String realm, String nonce, String qop, String nonceCount, String cnonce)
Generate an HTTP authorization response- Parameters:
method
- methoduri
- URIa1Hash
- a1Hashrealm
- realmnonce
- nonceqop
- qopnonceCount
- nonceCountcnonce
- cnonce- Returns:
- auth
-
generateAuth
public static String generateAuth(String a2Hash, String a1Hash, String realm, String nonce, String qop, String nonceCount, String cnonce)
Generate an HTTP authorization response- Parameters:
a2Hash
- a2Hasha1Hash
- a1Hashrealm
- realmnonce
- nonceqop
- qopnonceCount
- nonceCountcnonce
- cnonce- Returns:
- auth
-
generateHashBytes
public static byte[] generateHashBytes(byte[] value)
Generate SHA256 hash- Parameters:
value
- byte array to hash- Returns:
- byte array result
-
generateHashBytes
public static byte[] generateHashBytes(String value)
Generate SHA256 hash- Parameters:
value
- in string converted to byte array (UTF-8)- Returns:
- byte array result
-
generateHash
public static String generateHash(String value)
Generate SHA256 hash- Parameters:
value
- in string converted to byte array (UTF-8)- Returns:
- hash as binhex string
-
validate
public static boolean validate(String storedPassword, String username, String realm, String password)
-
-