add temp debugging of encrypted payloads

This commit is contained in:
Jan-Piet Mens
2016-01-24 13:38:49 +01:00
parent 452bbc8238
commit 28b776ba3e

View File

@@ -578,6 +578,7 @@ struct mosquitto_message *decrypt(struct udata *ud, const struct mosquitto_messa
olog(LOG_ERR, "no decryption key for %s in %s", UB(userdev), m->topic);
return (NULL);
}
fprintf(stderr, "Key for %s is [%s]\n", UB(userdev), key);
if ((msg = malloc(sizeof(struct mosquitto_message))) == NULL) {
return (NULL);
@@ -605,8 +606,8 @@ struct mosquitto_message *decrypt(struct udata *ud, const struct mosquitto_messa
}
if (crypto_secretbox_open_easy(cleartext, // message
ciphertext + crypto_secretbox_NONCEBYTES, // authtag + encrypted
ciphertext_len - crypto_secretbox_NONCEBYTES, // len (auth+encr)
ciphertext + crypto_secretbox_NONCEBYTES, // skip over nonce
ciphertext_len - crypto_secretbox_NONCEBYTES, // len (- nonce)
ciphertext, // nonce
key) != 0)
{