diff options
author | James Crayne <jim.crayne@gmail.com> | 2015-06-18 18:08:47 -0400 |
---|---|---|
committer | James Crayne <jim.crayne@gmail.com> | 2015-06-18 18:08:47 -0400 |
commit | 1edf4eafe890be20eb5b7416197a14f47b2baf0b (patch) | |
tree | b068ea6073c3ef4c3bb1d78970fe0e56da24226f | |
parent | c72a0a292d3b3e5b0c6d0c5cf395e658556eb4a2 (diff) |
Fix to work with x509>=1.5, probably breaks 1.4
-rw-r--r-- | KeyRing.hs | 9 | ||||
-rw-r--r-- | TimeUtil.hs | 1 | ||||
-rw-r--r-- | kiki.cabal | 3 |
3 files changed, 11 insertions, 2 deletions
@@ -145,8 +145,13 @@ import qualified Data.Text as T ( Text, unpack, pack, | |||
145 | import qualified System.Posix.Types as Posix | 145 | import qualified System.Posix.Types as Posix |
146 | import System.Posix.Files ( modificationTime, getFileStatus, getFdStatus | 146 | import System.Posix.Files ( modificationTime, getFileStatus, getFdStatus |
147 | , setFileCreationMask, setFileTimes ) | 147 | , setFileCreationMask, setFileTimes ) |
148 | #if MIN_VERSION_x509(1,5,0) | ||
149 | import Data.Hourglass.Types | ||
150 | import Data.Hourglass | ||
151 | #endif | ||
148 | #if MIN_VERSION_unix(2,7,0) | 152 | #if MIN_VERSION_unix(2,7,0) |
149 | import System.Posix.Files ( setFdTimesHiRes ) | 153 | import System.Posix.Files ( setFdTimesHiRes ) |
154 | import Foreign.C.Types ( CTime(..), CLong, CInt(..) ) | ||
150 | #else | 155 | #else |
151 | import Foreign.C.Types ( CTime(..), CLong, CInt(..) ) | 156 | import Foreign.C.Types ( CTime(..), CLong, CInt(..) ) |
152 | import Foreign.Marshal.Array ( withArray ) | 157 | import Foreign.Marshal.Array ( withArray ) |
@@ -1472,7 +1477,9 @@ parseCertBlob comp bs = do | |||
1472 | let asn1' = drop 2 asn1 | 1477 | let asn1' = drop 2 asn1 |
1473 | cert <- either (const Nothing) (Just . fst) (fromASN1 asn1') | 1478 | cert <- either (const Nothing) (Just . fst) (fromASN1 asn1') |
1474 | let _ = cert :: X509.Certificate | 1479 | let _ = cert :: X509.Certificate |
1475 | (notBefore,_) = X509.certValidity cert | 1480 | notBefore :: UTCTime |
1481 | notBefore = toUTC ( timeFromElapsedP (timeGetElapsedP vincentTime) :: CTime) -- nanoToUTCTime nano | ||
1482 | where (vincentTime,_) = X509.certValidity cert | ||
1476 | case X509.certPubKey cert of | 1483 | case X509.certPubKey cert of |
1477 | X509.PubKeyRSA key -> do | 1484 | X509.PubKeyRSA key -> do |
1478 | let withoutkey = | 1485 | let withoutkey = |
diff --git a/TimeUtil.hs b/TimeUtil.hs index 9c0a2b5..9035e50 100644 --- a/TimeUtil.hs +++ b/TimeUtil.hs | |||
@@ -4,6 +4,7 @@ module TimeUtil | |||
4 | ( now | 4 | ( now |
5 | , IsTime(..) | 5 | , IsTime(..) |
6 | , fromTime | 6 | , fromTime |
7 | , toUTC | ||
7 | , parseRFC2822 | 8 | , parseRFC2822 |
8 | , printRFC2822 | 9 | , printRFC2822 |
9 | , dateParser | 10 | , dateParser |
@@ -22,7 +22,8 @@ Executable kiki | |||
22 | bytestring -any, openpgp (>=0.6.1), binary -any, | 22 | bytestring -any, openpgp (>=0.6.1), binary -any, |
23 | unix, time, | 23 | unix, time, |
24 | containers -any, process -any, filepath -any, | 24 | containers -any, process -any, filepath -any, |
25 | network -any, old-locale -any, zlib -any | 25 | network -any, old-locale -any, zlib -any, |
26 | hourglass -any | ||
26 | ghc-options: -O2 -fwarn-unused-binds -fwarn-unused-imports | 27 | ghc-options: -O2 -fwarn-unused-binds -fwarn-unused-imports |
27 | c-sources: dotlock.c | 28 | c-sources: dotlock.c |
28 | 29 | ||