|
|
|
@ -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: Host is assumed to be ISO 8859-1; make list of assumptions. |
|
|
|
-- TODO: Can it contain newline characters? |
|
|
|
-- 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 Prelude hiding (concat, zipWith) |
|
|
|
import Data.ByteString.Internal (c2w) |
|
|
|
import Data.ByteString.Internal (c2w) |
|
|
|
@ -160,6 +160,16 @@ clientProof :: ByteString -> ByteString -> ByteString |
|
|
|
clientProof ck cs = pack $ zipWith xor ck cs |
|
|
|
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. |
|
|
|
-- TODO: Implement SCRAM. |
|
|
|
|
|
|
|
|
|
|
|
replyToChallenge = replyToChallenge |
|
|
|
replyToChallenge = replyToChallenge |
|
|
|
|