Package org.openwebnet4j.communication
Class Auth
- java.lang.Object
 - 
- org.openwebnet4j.communication.Auth
 
 
- 
public class Auth extends Object
Class contains helper methods for authenticating to a BUS OpenWebNet gateway using a numeric (OPEN) or alphanumeric (HMAC) password. Encoding algorithm for OPEN numeric password can be found at this link: https://rosettacode.org/wiki/OpenWebNet_Password#JavaScript HMAC authentication algorithm can be found at this Legrand/BTicino link: https://developer.legrand.com/documentation/open-web-net-for-myhome/- Author:
 - M. Valla - Initial contribution
 
 
- 
- 
Constructor Summary
Constructors Constructor Description Auth() 
- 
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static StringbytesToHex(byte[] bytes)Convert bytes array to hex stringprotected static StringcalcHmacRb()Generate Rb HMAC random hex string from: key=timeMSEC_SINCE_EPOCH using SHA-256protected static StringcalcOpenPass(String pass, String nonce)Encodes a numeric OPEN passwordprotected static StringcalcSHA256(String message)Return SHA-256 hash of the input stringprotected static StringdigitToHex(String digits)Convert [0-9] digits string to hex stringprotected static StringhexToDigit(String hexString)Convert hex string to [0-9] digits string 
 - 
 
- 
- 
Method Detail
- 
digitToHex
protected static String digitToHex(String digits)
Convert [0-9] digits string to hex string- Parameters:
 digits- string to convert- Returns:
 - hex string
 
 
- 
hexToDigit
protected static String hexToDigit(String hexString)
Convert hex string to [0-9] digits string- Parameters:
 hexString- string to convert- Returns:
 - digits string
 
 
- 
bytesToHex
protected static String bytesToHex(byte[] bytes)
Convert bytes array to hex string- Parameters:
 bytes- array to convert- Returns:
 - hex string
 
 
- 
calcHmacRb
protected static String calcHmacRb()
Generate Rb HMAC random hex string from: key=timeMSEC_SINCE_EPOCH using SHA-256- Returns:
 - the generated Rb HMAC
 
 
- 
calcSHA256
protected static String calcSHA256(String message)
Return SHA-256 hash of the input string- Parameters:
 message- string to hash- Returns:
 - the hash string
 
 
 - 
 
 -