diff options
-rw-r--r-- | KeyRing.hs | 15 | ||||
-rw-r--r-- | kiki.hs | 8 |
2 files changed, 12 insertions, 11 deletions
@@ -205,13 +205,10 @@ data InputFile = HomeSec | |||
205 | 205 | ||
206 | -- type UsageTag = String | 206 | -- type UsageTag = String |
207 | type Initializer = String | 207 | type Initializer = String |
208 | type PasswordFile = InputFile | ||
209 | 208 | ||
210 | data FileType = KeyRingFile (Maybe PasswordFile) | 209 | data 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 | |||
301 | ispem (PEMFile {}) = True | 298 | ispem (PEMFile {}) = True |
302 | ispem _ = False | 299 | ispem _ = False |
303 | 300 | ||
304 | pwfile :: FileType -> Maybe PasswordFile | 301 | {- |
302 | pwfile :: FileType -> Maybe InputFile | ||
305 | pwfile (KeyRingFile f) = f | 303 | pwfile (KeyRingFile f) = f |
306 | pwfile _ = Nothing | 304 | pwfile _ = Nothing |
305 | -} | ||
307 | 306 | ||
308 | iswallet :: FileType -> Bool | 307 | iswallet :: FileType -> Bool |
309 | iswallet (WalletFile {}) = True | 308 | iswallet (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) |
@@ -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 |