sasl: SASL implementation using simple-pipe
This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.
Example programs
SCRAM-SHA-1 Client sample
scramSha1sv.txt
r=00DEADBEEF007658cddf-0e44-4de2-87df-4132bce97f4,s=cGVwcGVy,i=4492 v=q0+IZgUtQTHYItaurlNyET1imLI= success
examples/clientS.hs
extensions
OverloadedStrings
PackageImports
import "monads-tf" Control.Monad.State import Data.Pipe import Data.Pipe.ByteString import System.IO import Network.Sasl import Network.Sasl.ScramSha1.Client import qualified Data.ByteString as BS data St = St [(BS.ByteString, BS.ByteString)] deriving Show instance SaslState St where getSaslState (St s) = s putSaslState s _ = St s serverFile :: String serverFile = "examples/scramSha1sv.txt" main :: IO () main = do let (_, (_, p)) = sasl r <- runPipe (fromFileLn serverFile =$= input =$= p =$= toHandleLn stdout) `runStateT` St [ ("username", "yoshikuni"), ("password", "password"), ("cnonce", "00DEADBEEF00") ] print r input :: Pipe BS.ByteString (Either Success BS.ByteString) (StateT St IO) () input = await >>= \mbs -> case mbs of Just "success" -> yield . Left $ Success Nothing Just ch -> yield (Right ch) >> input _ -> return ()
SCRAM-SHA-1 Server sample
scramSha1cl.txt
n,,n=yoshikuni,r=00DEADBEEF00 c=biws,r=00DEADBEEF007658cddf-0e44-4de2-87df-4132bce97f4,p=zup7ghwpAW43cP4Xu3YZTNnHo0g=
examples/serverS.hs
extensions
OverloadedStrings
PackageImports
import "monads-tf" Control.Monad.State import Data.Pipe import Data.Pipe.ByteString import System.IO import Network.Sasl import Network.Sasl.ScramSha1.Server import qualified Data.ByteString as BS data St = St [(BS.ByteString, BS.ByteString)] deriving Show instance SaslState St where getSaslState (St s) = s putSaslState s _ = St s clientFile :: String clientFile = "examples/scramSha1cl.txt" main :: IO () main = do let slt = "pepper" i = 4492 (stk, svk) = salt "password" slt i (_, (_, p)) = sasl $ \"yoshikuni" -> return (slt, stk, svk, i) r <- runPipe (fromFileLn clientFile =$= p =$= output =$= toHandleLn stdout) `runStateT` St [("snonce", "7658cddf-0e44-4de2-87df-4132bce97f4")] print r output :: Pipe (Either Success BS.ByteString) BS.ByteString (StateT St IO) () output = await >>= \mch -> case mch of Just (Left (Success Nothing)) -> yield "success" Just (Left (Success (Just bs))) -> yield bs Just (Right bs) -> yield bs >> output _ -> return ()
See examples directory for more examples.
Properties
Versions | 0.0.0.0, 0.0.0.0, 0.0.0.1, 0.0.0.2 |
---|---|
Change log | None available |
Dependencies | base (>=4 && <5), base64-bytestring (>=1.0 && <1.1), bytestring (>=0.10 && <0.11), cryptohash (>=0.11 && <0.12), monads-tf (>=0.1 && <0.2), papillon (>=0.1 && <0.2), simple-pipe (>=0.0.0 && <0.0.1) [details] |
License | BSD-3-Clause |
Author | Yoshikuni Jujo <PAF01143@nifty.ne.jp> |
Maintainer | Yoshikuni Jujo <PAF01143@nifty.ne.jp> |
Category | Network |
Home page | https://github.com/YoshikuniJujo/sasl/wiki |
Source repo | head: git clone git://github.com/YoshikuniJujo/sasl.git this: git clone git://github.com/YoshikuniJujo/sasl.git(tag sasl-0.0.0.0) |
Uploaded | by YoshikuniJujo at 2014-08-15T06:43:41Z |
Modules
- Network
- Network.Sasl
- DigestMd5
- Network.Sasl.DigestMd5.Client
- Network.Sasl.DigestMd5.Server
- External
- Network.Sasl.External.Client
- Network.Sasl.External.Server
- Plain
- Network.Sasl.Plain.Client
- Network.Sasl.Plain.Server
- ScramSha1
- Network.Sasl.ScramSha1.Client
- Network.Sasl.ScramSha1.Server
- DigestMd5
- Network.Sasl
Downloads
- sasl-0.0.0.0.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
Package maintainers
For package maintainers and hackage trustees