summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--KeyRing.hs15
-rw-r--r--kiki.hs8
2 files changed, 12 insertions, 11 deletions
diff --git a/KeyRing.hs b/KeyRing.hs
index 9d046b6..b0d1b67 100644
--- a/KeyRing.hs
+++ b/KeyRing.hs
@@ -205,13 +205,10 @@ data InputFile = HomeSec
205 205
206-- type UsageTag = String 206-- type UsageTag = String
207type Initializer = String 207type Initializer = String
208type PasswordFile = InputFile
209 208
210data FileType = KeyRingFile (Maybe PasswordFile) 209data FileType = KeyRingFile
211 -- ^ PasswordFile parameter is deprecated in favor
212 -- of opPassphrases. TODO: remove it.
213 | PEMFile 210 | PEMFile
214 | WalletFile -- (Maybe UsageTag) 211 | WalletFile
215 | Hosts 212 | Hosts
216 213
217-- | Use this type to indicate whether a file of type 'KeyRingFile' is expected 214-- | Use this type to indicate whether a file of type 'KeyRingFile' is expected
@@ -301,9 +298,11 @@ ispem :: FileType -> Bool
301ispem (PEMFile {}) = True 298ispem (PEMFile {}) = True
302ispem _ = False 299ispem _ = False
303 300
304pwfile :: FileType -> Maybe PasswordFile 301{-
302pwfile :: FileType -> Maybe InputFile
305pwfile (KeyRingFile f) = f 303pwfile (KeyRingFile f) = f
306pwfile _ = Nothing 304pwfile _ = Nothing
305-}
307 306
308iswallet :: FileType -> Bool 307iswallet :: FileType -> Bool
309iswallet (WalletFile {}) = True 308iswallet (WalletFile {}) = True
@@ -1791,10 +1790,12 @@ makeMemoizingDecrypter operation ctx keys = do
1791 -- TODO: Perhaps these should both be of type InputFile rather than 1790 -- TODO: Perhaps these should both be of type InputFile rather than
1792 -- FilePath? 1791 -- FilePath?
1793 -- pws :: Map.Map FilePath (IO S.ByteString) 1792 -- pws :: Map.Map FilePath (IO S.ByteString)
1793 {-
1794 pws <- 1794 pws <-
1795 Traversable.mapM (cachedContents ctx . fromJust . pwfile . typ) 1795 Traversable.mapM (cachedContents ctx . fromJust . pwfile . typ)
1796 (Map.mapKeys (resolveForReport Nothing) -- see note (*) note above 1796 (Map.mapKeys (resolveForReport Nothing) -- see note (*) note above
1797 $ Map.filter (isJust . pwfile . typ) $ opFiles operation) 1797 $ Map.filter (isJust . pwfile . typ) $ opFiles operation)
1798 -}
1798 pws2 <- 1799 pws2 <-
1799 Traversable.mapM (cachedContents ctx) 1800 Traversable.mapM (cachedContents ctx)
1800 $ Map.fromList $ mapMaybe 1801 $ Map.fromList $ mapMaybe
@@ -1808,7 +1809,7 @@ makeMemoizingDecrypter operation ctx keys = do
1808 && isNothing (passSpecKeySpec sp)) 1809 && isNothing (passSpecKeySpec sp))
1809 $ opPassphrases operation 1810 $ opPassphrases operation
1810 unkeysRef <- newIORef (Map.empty :: Map.Map KeyKey Packet) 1811 unkeysRef <- newIORef (Map.empty :: Map.Map KeyKey Packet)
1811 return $ doDecrypt unkeysRef (pws `Map.union` pws2) defpw 1812 return $ doDecrypt unkeysRef ({- pws `Map.union` -} pws2) defpw
1812 where 1813 where
1813 doDecrypt :: IORef (Map.Map KeyKey Packet) 1814 doDecrypt :: IORef (Map.Map KeyKey Packet)
1814 -> Map.Map FilePath (IO S.ByteString) 1815 -> Map.Map FilePath (IO S.ByteString)
diff --git a/kiki.hs b/kiki.hs
index a3c0a56..cae8ae8 100644
--- a/kiki.hs
+++ b/kiki.hs
@@ -705,7 +705,7 @@ sync bExport bImport bSecret cmdarg args_raw = do
705 , (buildStreamInfo reftyp WalletFile) { access = Sec })) 705 , (buildStreamInfo reftyp WalletFile) { access = Sec }))
706 wallets 706 wallets
707 rings = map (\fname -> ( ArgFile fname 707 rings = map (\fname -> ( ArgFile fname
708 , buildStreamInfo reftyp $ KeyRingFile passfd)) 708 , buildStreamInfo reftyp KeyRingFile ))
709 keyrings_ 709 keyrings_
710 hosts = maybe [] (map decorate) $ Map.lookup "--hosts" margs 710 hosts = maybe [] (map decorate) $ Map.lookup "--hosts" margs
711 where decorate fname = (ArgFile fname, buildStreamInfo reftyp Hosts) 711 where decorate fname = (ArgFile fname, buildStreamInfo reftyp Hosts)
@@ -726,10 +726,10 @@ sync bExport bImport bSecret cmdarg args_raw = do
726 { opFiles = Map.fromList $ 726 { opFiles = Map.fromList $
727 [ ( HomeSec, buildStreamInfo (if bSecret && bImport then KF_All 727 [ ( HomeSec, buildStreamInfo (if bSecret && bImport then KF_All
728 else KF_None) 728 else KF_None)
729 (KeyRingFile passfd) ) 729 KeyRingFile )
730 , ( HomePub, buildStreamInfo (if bImport then pubfill 730 , ( HomePub, buildStreamInfo (if bImport then pubfill
731 else KF_None) 731 else KF_None)
732 (KeyRingFile Nothing) ) 732 KeyRingFile )
733 ] 733 ]
734 ++ rings 734 ++ rings
735 ++ if bSecret then pems else [] 735 ++ if bSecret then pems else []
@@ -825,7 +825,7 @@ kiki "show" args = do
825 hosts = [] 825 hosts = []
826 walts = [] 826 walts = []
827 streaminfo = StreamInfo { fill = KF_None 827 streaminfo = StreamInfo { fill = KF_None
828 , typ = KeyRingFile passfd 828 , typ = KeyRingFile
829 , spill = KF_All 829 , spill = KF_All
830 , initializer = Nothing 830 , initializer = Nothing
831 , access = AutoAccess 831 , access = AutoAccess