diff options
Diffstat (limited to 'lib/KeyRing.hs')
-rw-r--r-- | lib/KeyRing.hs | 12 |
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 | ||
105 | import System.Environment | 107 | import 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 | ||
667 | uncamel :: String -> String | 669 | uncamel :: String -> String |
668 | uncamel str = unwords $ firstWord ++ (toLower .: otherWords) ++ args | 670 | uncamel str = unwords $ firstWord ++ (toLower .: otherWords) ++ args |
@@ -2246,8 +2248,8 @@ pemFromPacket AutoAccess p@(SecretKeyPacket {}) = pemFromPacket Sec p | |||
2246 | pemFromPacket AutoAccess _ = Nothing | 2248 | pemFromPacket AutoAccess _ = Nothing |
2247 | 2249 | ||
2248 | writeKeyToFile :: | 2250 | writeKeyToFile :: |
2249 | Bool -> StreamInfo -> InputFile -> Packet -> IO [(InputFile, KikiReportAction)] | 2251 | StreamInfo -> InputFile -> Packet -> IO [(InputFile, KikiReportAction)] |
2250 | writeKeyToFile False stream@(StreamInfo { typ = PEMFile }) fname packet = do | 2252 | writeKeyToFile 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 | ||
2263 | writeKeyToFile False StreamInfo { typ = DNSPresentation } fname packet = do | 2265 | writeKeyToFile 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 |