summaryrefslogtreecommitdiff
path: root/lib/KeyRing.hs
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2016-04-26 17:45:29 -0400
committerjoe <joe@jerkface.net>2016-04-26 17:45:29 -0400
commit058e3e2293ed7ced0f77fc6f6a75d73ee5610042 (patch)
tree1ea42d638308be1f25073af047e278ac39a0a18c /lib/KeyRing.hs
parentbcf03d8c7aa88dc5ac6355e93b1168daee338bb6 (diff)
put the proper time stamps on ipsec/ssh exports.
Diffstat (limited to 'lib/KeyRing.hs')
-rw-r--r--lib/KeyRing.hs12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/KeyRing.hs b/lib/KeyRing.hs
index a0d1e1a..21d7c3e 100644
--- a/lib/KeyRing.hs
+++ b/lib/KeyRing.hs
@@ -100,6 +100,8 @@ module KeyRing
100 , secretPemFromPacket 100 , secretPemFromPacket
101 , SubkeyStatus(..) 101 , SubkeyStatus(..)
102 , getSubkeys 102 , getSubkeys
103 , writeKeyToFile
104 , resolveForReport
103 ) where 105 ) where
104 106
105import System.Environment 107import System.Environment
@@ -662,7 +664,7 @@ data KikiReportAction =
662 | FailedFileWrite 664 | FailedFileWrite
663 | HostsDiff ByteString 665 | HostsDiff ByteString
664 | DeletedPacket String 666 | DeletedPacket String
665 deriving Show 667 deriving (Eq,Show)
666 668
667uncamel :: String -> String 669uncamel :: String -> String
668uncamel str = unwords $ firstWord ++ (toLower .: otherWords) ++ args 670uncamel str = unwords $ firstWord ++ (toLower .: otherWords) ++ args
@@ -2246,8 +2248,8 @@ pemFromPacket AutoAccess p@(SecretKeyPacket {}) = pemFromPacket Sec p
2246pemFromPacket AutoAccess _ = Nothing 2248pemFromPacket AutoAccess _ = Nothing
2247 2249
2248writeKeyToFile :: 2250writeKeyToFile ::
2249 Bool -> StreamInfo -> InputFile -> Packet -> IO [(InputFile, KikiReportAction)] 2251 StreamInfo -> InputFile -> Packet -> IO [(InputFile, KikiReportAction)]
2250writeKeyToFile False stream@(StreamInfo { typ = PEMFile }) fname packet = do 2252writeKeyToFile stream@(StreamInfo { typ = PEMFile }) fname packet = do
2251 case pemFromPacket (access stream) packet of 2253 case pemFromPacket (access stream) packet of
2252 Just output -> do 2254 Just output -> do
2253 let stamp = toEnum . fromEnum $ timestamp packet 2255 let stamp = toEnum . fromEnum $ timestamp packet
@@ -2260,7 +2262,7 @@ writeKeyToFile False stream@(StreamInfo { typ = PEMFile }) fname packet = do
2260 return [(fname, ExportedSubkey)] 2262 return [(fname, ExportedSubkey)]
2261 Nothing -> return [(fname, UnableToExport (key_algorithm packet) $ fingerprint packet)] 2263 Nothing -> return [(fname, UnableToExport (key_algorithm packet) $ fingerprint packet)]
2262 2264
2263writeKeyToFile False StreamInfo { typ = DNSPresentation } fname packet = do 2265writeKeyToFile StreamInfo { typ = DNSPresentation } fname packet = do
2264 case key_algorithm packet of 2266 case key_algorithm packet of
2265 RSA -> do 2267 RSA -> do
2266 flip (maybe (return [])) 2268 flip (maybe (return []))
@@ -2308,7 +2310,7 @@ writePEMKeys doDecrypt db exports = do
2308 let ds' = map functorToEither ds 2310 let ds' = map functorToEither ds
2309 if null (lefts ds') 2311 if null (lefts ds')
2310 then do 2312 then do
2311 rs <- mapM (\(f,stream,p) -> writeKeyToFile False stream (ArgFile f) p) 2313 rs <- mapM (\(f,stream,p) -> writeKeyToFile stream (ArgFile f) p)
2312 (rights ds') 2314 (rights ds')
2313 return $ KikiSuccess (map (first $ resolveForReport Nothing) $ concat rs) 2315 return $ KikiSuccess (map (first $ resolveForReport Nothing) $ concat rs)
2314 else do 2316 else do