B4J Question MQTTBrokerExtended exemple

grenness

New Member
Hello everyone, my name is Guillaume, i'm french (so sorry for my bad englich) and I'm new on B4J.
I try using MQTTBrokerExtended library exemple.
The broker demo autorizationdemo.
But i always get this error:

13/04/2022 10:43:11.680 ERROR Error processing protocol message: CONNECT
13/04/2022 10:43:11.680 INFO Closed client channel due to exception in processing

I have just change the password file with my name en my encodeded base64 password.

any idea?
Best regards.
Guillaume
 

grenness

New Member
Thanks, it work better when i modify some line in the programme.(direct return true)
But i'am not shure of encoded format in the password file.
I have test with base64, md5 and sha256, all this format seems to be wrong?
Witch encoded format is it ?

Guillaume
 
Upvote 0

Gandalf

Member
Licensed User
Longtime User
Looking at this code in the example
B4X:
Dim MD5() As Byte = MD.GetMessageDigest(Password, "MD5")
Dim StoredMD5 As String = PasswordMap.Get(Username)
Return (B64.EncodeBtoS(MD5, 0, MD5.Length) = StoredMD5)
I can say that the password file format is Map containing values of MD5 hashes (as byte arrays) encoded to base64 strings.

Use this code to generate your values for passwords file:
B4X:
Dim pstring As String = "1234"    'Change this to your password string
Dim pbytes() As Byte = pstring.GetBytes("UTF8")
Dim pMD5() As Byte = MD.GetMessageDigest(pbytes, "MD5")
Dim pFileValue As String = B64.EncodeBtoS(pMD5, 0, pMD5.Length)
Log(pFileValue)
 
Last edited:
Upvote 0
Top