network-conduit-tls 1.1.0.2 → 1.1.1
raw patch · 5 files changed
+48/−11 lines, 5 filesdep ~tlsPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: tls
API changes (from Hackage documentation)
+ Data.Conduit.Network.TLS: tlsConfigChain :: HostPreference -> Int -> FilePath -> [FilePath] -> FilePath -> TLSConfig
+ Data.Conduit.Network.TLS: tlsConfigChainBS :: HostPreference -> Int -> ByteString -> [ByteString] -> ByteString -> TLSConfig
+ Data.Conduit.Network.TLS.Internal: getTLSChainCerts :: TlsCertData -> IO [ByteString]
- Data.Conduit.Network.TLS.Internal: TlsCertData :: IO ByteString -> IO ByteString -> TlsCertData
+ Data.Conduit.Network.TLS.Internal: TlsCertData :: IO ByteString -> IO [ByteString] -> IO ByteString -> TlsCertData
Files
- ChangeLog.md +3/−0
- Data/Conduit/Network/TLS.hs +38/−9
- Data/Conduit/Network/TLS/Internal.hs +1/−0
- README.md +3/−0
- network-conduit-tls.cabal +3/−2
+ ChangeLog.md view
@@ -0,0 +1,3 @@+## 1.1.1++* Support chain certificates in network-conduit-tls [#203](https://github.com/snoyberg/conduit/pull/203)
Data/Conduit/Network/TLS.hs view
@@ -9,6 +9,8 @@ TLSConfig , tlsConfigBS , tlsConfig+ , tlsConfigChainBS+ , tlsConfigChain , tlsHost , tlsPort -- , tlsCertificate@@ -58,19 +60,24 @@ import Data.Default -makeCertDataPath :: FilePath -> FilePath -> TlsCertData-makeCertDataPath certPath keyPath = TlsCertData (readFile certPath) (readFile keyPath)--makeCertDataBS :: S.ByteString -> S.ByteString -> TlsCertData-makeCertDataBS certBS keyBS = TlsCertData (return certBS) (return keyBS)+makeCertDataPath :: FilePath -> [FilePath] -> FilePath -> TlsCertData+makeCertDataPath certPath chainCertPaths keyPath =+ TlsCertData+ (readFile certPath)+ (mapM readFile chainCertPaths)+ (readFile keyPath) +makeCertDataBS :: S.ByteString -> [S.ByteString] -> S.ByteString ->+ TlsCertData+makeCertDataBS certBS chainCertsBS keyBS =+ TlsCertData (return certBS) (return chainCertsBS) (return keyBS) tlsConfig :: HostPreference -> Int -- ^ port -> FilePath -- ^ certificate -> FilePath -- ^ key -> TLSConfig-tlsConfig a b c d = TLSConfig a b (makeCertDataPath c d) False+tlsConfig a b c d = tlsConfigChain a b c [] d -- | allow to build a server config directly from raw bytestring data (exact same@@ -81,9 +88,31 @@ -> S.ByteString -- ^ Certificate raw data -> S.ByteString -- ^ Key file raw data -> TLSConfig-tlsConfigBS a b c d = TLSConfig a b (makeCertDataBS c d ) False+tlsConfigBS a b c d = tlsConfigChainBS a b c [] d +-- | Like 'tlsConfig', but also allow specifying chain certificates.+--+-- Since 1.1.1+tlsConfigChain :: HostPreference+ -> Int -- ^ Port+ -> FilePath -- ^ Certificate+ -> [FilePath] -- ^ Chain certificates+ -> FilePath -- ^ Key+ -> TLSConfig+tlsConfigChain a b c d e = TLSConfig a b (makeCertDataPath c d e) False ++-- | Like 'tlsConfigBS', but also allow specifying chain certificates.+--+-- Since 1.1.1+tlsConfigChainBS :: HostPreference+ -> Int -- ^ Port+ -> S.ByteString -- ^ Certificate raw data+ -> [S.ByteString] -- ^ Chain certificate raw data+ -> S.ByteString -- ^ Key file raw data+ -> TLSConfig+tlsConfigChainBS a b c d e = TLSConfig a b (makeCertDataBS c d e) False+ serverHandshake :: Socket -> TLS.Credentials -> IO (TLS.Context) serverHandshake socket creds = do gen <- Crypto.Random.AESCtr.makeSystem@@ -210,8 +239,8 @@ ] readCreds :: TlsCertData -> IO TLS.Credentials-readCreds (TlsCertData iocert iokey) =- (TLS.credentialLoadX509FromMemory <$> iocert <*> iokey)+readCreds (TlsCertData iocert iochains iokey) =+ (TLS.credentialLoadX509ChainFromMemory <$> iocert <*> iochains <*> iokey) >>= either (error . ("Error reading TLS credentials: " ++)) (return . TLS.Credentials . return)
Data/Conduit/Network/TLS/Internal.hs view
@@ -10,6 +10,7 @@ -- structure providing access to certificate and key data through call backs data TlsCertData = TlsCertData { getTLSCert :: IO S.ByteString+ , getTLSChainCerts :: IO [S.ByteString] , getTLSKey :: IO S.ByteString }
+ README.md view
@@ -0,0 +1,3 @@+## network-conduit-tls++Create TLS-aware network code with conduits. Uses the tls package for a pure-Haskell implementation.
network-conduit-tls.cabal view
@@ -1,5 +1,5 @@ name: network-conduit-tls-version: 1.1.0.2+version: 1.1.1 synopsis: Create TLS-aware network code with conduits description: Uses the tls package for a pure-Haskell implementation. homepage: https://github.com/snoyberg/conduit@@ -10,6 +10,7 @@ category: Network build-type: Simple cabal-version: >=1.8+extra-source-files: README.md ChangeLog.md library exposed-modules: Data.Conduit.Network.TLS@@ -18,7 +19,7 @@ , system-filepath >= 0.4 , system-fileio >= 0.3 , bytestring >= 0.9- , tls >= 1.2.2+ , tls >= 1.2.15 , conduit-extra >= 1.1 , conduit >= 1.1 , network