Software /
code /
prosody
Changeset
7103:5c6e78dc1864
mod_dialback: Follow XEP-0185 and use HMAC
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 19 Jan 2016 21:31:02 +0100 |
parents | 7077:0386ccf20ac7 |
children | 7104:352270bc0439 |
files | plugins/mod_dialback.lua |
diffstat | 1 files changed, 2 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_dialback.lua Sun Jan 10 23:25:00 2016 +0100 +++ b/plugins/mod_dialback.lua Tue Jan 19 21:31:02 2016 +0100 @@ -12,6 +12,7 @@ local st = require "util.stanza"; local sha256_hash = require "util.hashes".sha256; +local sha256_hmac = require "util.hashes".hmac_sha256; local nameprep = require "util.encodings".stringprep.nameprep; local xmlns_stream = "http://etherx.jabber.org/streams"; @@ -19,7 +20,7 @@ local dialback_requests = setmetatable({}, { __mode = 'v' }); function generate_dialback(id, to, from) - return sha256_hash(id..to..from..hosts[from].dialback_secret, true); + return sha256_hmac(sha256_hash(hosts[from].dialback_secret), to .. ' ' .. from .. ' ' .. id, true); end function initiate_dialback(session)