Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abus Secvest encryption doesn't work #6

Open
HackyPaddy opened this issue Mar 8, 2024 · 9 comments
Open

Abus Secvest encryption doesn't work #6

HackyPaddy opened this issue Mar 8, 2024 · 9 comments
Assignees

Comments

@HackyPaddy
Copy link

Hello :)

with my Abus Secvest, i have a problem with your code.
Messages without AES-encryption work fine, but with the encryption, your adapter received the encrypted message and decrypts this. Everything is fine up to this point.

But, the acknowledge is not understood by the system and the Secvest issues a reporting fault.
No matter whether 128, 192, 256 aes-encryption.

Do you have help for me?

Greetings

Patrick

@Supergiovane
Copy link
Owner

Hi Patrick
i checked now, but i cannot help you, because i've never used the encryption and i don't have any alarm panel supporting it to do a test.
You could ask in iobroker forum about that, because my node is partially based on SIA implementation of iobroker.

@HackyPaddy
Copy link
Author

HackyPaddy commented Mar 8, 2024

Thx, for your answer.
I think, the buffer for the pad message in your script doesn't work.

I have included an output of "pad", "padlen" and "result" in the script. This is the output:
292 - debug: node-red.0 (3206272) 8 Mar 03:45:02 - [info] PAD: - - Padlen:10 - - RESULT:|]_02:45:02,03-08-2024

"- -" are separators.

The value "pad" is empty. Is it right so?
Can i output the pad on a debug?

Sry, I haven't worked with buffers yet and I'm not familiar with them.

@Supergiovane
Copy link
Owner

Hi
Sincerely, i don’t remember how it must be (the pad).
If you’re able, you could do the changes and send me a PR.

@HackyPaddy
Copy link
Author

HackyPaddy commented Mar 9, 2024

Hey,

That's exactly it, I've never worked with buffers before, that's why I turned to you.

But I can tell you how it has to work.

The pad must always be a multiple of 16. That works!
And here the description:

Pad data shall be pseudo-random bytes which vary from one message to the next. This data
will consist of binary values 0-255, except that it shall not contain the ASCII values for the
character "|" (124, x7C), "[" (91, x5B) or "]" (93, x5D).

How do I get it to generate binary data?

if (sia.id[0] == "*") {
let msglen = ('|]' + ts).length;
let padlen = 16 - (msglen % 16);
// let pad = new Buffer(padlen);
let pad = Buffer.alloc(padlen, padlen);
// let pad = Buffer.alloc(padlen, 0x00);
let msg = encrypt_hex(cfg.password, pad + '|]' + ts);
let dmsg = decrypt_hex(cfg.password, msg); // only for deguging
let dmsghex = new Buffer.from(dmsg).toString('hex');

The Buffer.alloc should generate the data.

let pad = Buffer.alloc(padlen, padlen);

But in the console.log the pad is empty...

I added the code:
RED.log.info("PAD:" + pad + " - - " + "Padlen:" + padlen + " - - " + "RESULT:" + pad + '|]' + ts);

and the result is:

292 - debug: node-red.0 (3206272) 8 Mar 03:45:02 - [info] PAD: - - Padlen:10 - - RESULT:|]_02:45:02,03-08-2024

The buffer should have a size of 10. Thats right.
But, the pad is empty and so it doesn't work...

Best regards,

Patrick

@HackyPaddy
Copy link
Author

HackyPaddy commented Mar 9, 2024

In my opinion, a random of characters that corresponds to the length of padlen would first have to be generated. Then this part must be converted to byte (decimal or hex).

The characters “[ ] |” cannot be used.

How do you implement this in code?

@Supergiovane
Copy link
Owner

Hi
The node is based to iobroker sia implementation
Monday l’ll take a look

@HackyPaddy
Copy link
Author

Hey,

the iobroker-adapter has the same issue.
But, the adapter doesn't work at all. Not even if the messages are unencrypted.

Your code supports the unencryption messages :)

@HackyPaddy
Copy link
Author

HackyPaddy commented Mar 24, 2024 via email

@Supergiovane
Copy link
Owner

Hi Patrick
Sorry no, i’ve no time in these months. I’m barely able to maintain the other my nodes.
To fix that, i must review the code and understand again how SIA protocol works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants