Browse Source

calculated serverkey and serversignature to verify server success response

master
Jon Kristensen 15 years ago
parent
commit
5ce2f8aedd
  1. 12
      Network/XMPP/SASL.hs

12
Network/XMPP/SASL.hs

@ -26,7 +26,7 @@ with Pontarius XMPP. If not, see <http://www.gnu.org/licenses/>. @@ -26,7 +26,7 @@ with Pontarius XMPP. If not, see <http://www.gnu.org/licenses/>.
-- TODO: Host is assumed to be ISO 8859-1; make list of assumptions.
-- TODO: Can it contain newline characters?
module Network.XMPP.SASL (replyToChallenge, saltedPassword, clientKey, storedKey, authMessage, clientSignature, clientProof) where
module Network.XMPP.SASL (replyToChallenge, saltedPassword, clientKey, storedKey, authMessage, clientSignature, clientProof, serverKey, serverSignature) where
import Prelude hiding (concat, zipWith)
import Data.ByteString.Internal (c2w)
@ -160,6 +160,16 @@ clientProof :: ByteString -> ByteString -> ByteString @@ -160,6 +160,16 @@ clientProof :: ByteString -> ByteString -> ByteString
clientProof ck cs = pack $ zipWith xor ck cs
serverKey :: ByteString -> ByteString
serverKey sp = encodeLazy (hmac (MacKey (head $ toChunks sp)) (DBLC.pack "Server Key") :: SHA1)
serverSignature :: ByteString -> ByteString -> ByteString
serverSignature servkey am = encodeLazy (hmac (MacKey (head $ toChunks servkey)) am :: SHA1)
-- TODO: Implement SCRAM.
replyToChallenge = replyToChallenge

Loading…
Cancel
Save