packages feed

x509-system 1.6.0 → 1.6.1

raw patch · 3 files changed

+13/−8 lines, 3 filesdep +asn1-encoding

Dependencies added: asn1-encoding

Files

System/X509/MacOS.hs view
@@ -11,16 +11,19 @@ import Data.X509 import Data.X509.CertificateStore -rootCAKeyChain :: String+rootCAKeyChain :: FilePath rootCAKeyChain = "/System/Library/Keychains/SystemRootCertificates.keychain" -listInKeyChain :: String -> IO [SignedCertificate]-listInKeyChain keyChain = do-    (_, Just hout, _, ph) <- createProcess (proc "security" ["find-certificate", "-pa", keyChain]) { std_out = CreatePipe }+systemKeyChain :: FilePath+systemKeyChain = "/Library/Keychains/System.keychain"++listInKeyChains :: [FilePath] -> IO [SignedCertificate]+listInKeyChains keyChains = do+    (_, Just hout, _, ph) <- createProcess (proc "security" ("find-certificate" : "-pa" : keyChains)) { std_out = CreatePipe }     pems <- either error id . pemParseLBS <$> LBS.hGetContents hout     let targets = rights $ map (decodeSignedCertificate . pemContent) $ filter ((=="CERTIFICATE") . pemName) pems     _ <- targets `seq` waitForProcess ph     return targets  getSystemCertificateStore :: IO CertificateStore-getSystemCertificateStore = makeCertificateStore <$> listInKeyChain rootCAKeyChain+getSystemCertificateStore = makeCertificateStore <$> listInKeyChains [rootCAKeyChain, systemKeyChain]
System/X509/Win32.hs view
@@ -11,11 +11,13 @@  import Control.Monad (when) import Control.Applicative+import Control.Exception (catch)  import qualified Data.ByteString.Internal as B  import Data.X509 import Data.X509.CertificateStore+import Data.ASN1.Error  import System.Win32.Types @@ -64,4 +66,4 @@                     case ecert of                         Left _     -> loop st r                         Right cert -> (cert :) <$> (loop st r)-+                    `catch` \(_ :: ASN1Error) -> loop st r
x509-system.cabal view
@@ -1,5 +1,5 @@ Name:                x509-system-Version:             1.6.0+Version:             1.6.1 Description:         System X.509 handling License:             BSD3 License-file:        LICENSE@@ -30,7 +30,7 @@   ghc-options:       -Wall   if os(windows)      cpp-options:     -DWINDOWS-     Build-Depends:   Win32+     Build-Depends:   Win32, asn1-encoding      extra-libraries: Crypt32      Exposed-modules: System.X509.Win32   if os(OSX)