summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2014-04-29 19:55:56 -0400
committerjoe <joe@jerkface.net>2014-04-29 19:55:56 -0400
commit90c2ea4ba234d7d049d72c2078044bc2a24e3977 (patch)
treee6b79c8548877c6a4be10a250922cfb397205348
parent243302a3ead05d463f4de092cb334ea06ae34ad3 (diff)
readKeyFromFile now accepts InputFile instead of FilePath
-rw-r--r--KeyRing.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/KeyRing.hs b/KeyRing.hs
index f9720fa..8d527e6 100644
--- a/KeyRing.hs
+++ b/KeyRing.hs
@@ -1103,14 +1103,14 @@ try x body =
1103 Left e -> return e 1103 Left e -> return e
1104 Right x -> body x 1104 Right x -> body x
1105 1105
1106readKeyFromFile :: Bool -> String -> FilePath -> IO Message 1106readKeyFromFile :: Bool -> String -> InputFile -> IO Message
1107readKeyFromFile False "PEM" fname = do 1107readKeyFromFile False "PEM" fname = do
1108 -- warn $ fname ++ ": reading ..." 1108 -- warn $ fname ++ ": reading ..."
1109 let ctx = InputFileContext "" ""
1109 -- Note: The key's timestamp is included in it's fingerprint. 1110 -- Note: The key's timestamp is included in it's fingerprint.
1110 -- Therefore, we should attempt to preserve it. 1111 -- Therefore, we should attempt to preserve it.
1111 timestamp <- handleIO_ (error $ fname++": modificaiton time?") $ 1112 timestamp <- getInputFileTime ctx fname
1112 modificationTime <$> getFileStatus fname 1113 input <- readInputFileL ctx fname
1113 input <- L.readFile fname
1114 let dta = extractPEM "RSA PRIVATE KEY" input 1114 let dta = extractPEM "RSA PRIVATE KEY" input
1115 -- Char8.putStrLn $ "dta = " <> dta 1115 -- Char8.putStrLn $ "dta = " <> dta
1116 let rsa = do 1116 let rsa = do
@@ -1161,7 +1161,7 @@ doImport
1161 -> ([Char], Maybe [Char], [k], t) 1161 -> ([Char], Maybe [Char], [k], t)
1162 -> IO (KikiCondition (Map.Map k KeyData, [(FilePath,KikiReportAction)])) 1162 -> IO (KikiCondition (Map.Map k KeyData, [(FilePath,KikiReportAction)]))
1163doImport doDecrypt db (fname,subspec,ms,_) = do 1163doImport doDecrypt db (fname,subspec,ms,_) = do
1164 let fetchkey = readKeyFromFile False "PEM" fname 1164 let fetchkey = readKeyFromFile False "PEM" (ArgFile fname)
1165 flip (maybe $ return CannotImportMasterKey) 1165 flip (maybe $ return CannotImportMasterKey)
1166 subspec $ \tag -> do 1166 subspec $ \tag -> do
1167 Message parsedkey <- fetchkey 1167 Message parsedkey <- fetchkey