diff options
Diffstat (limited to 'KeyRing.hs')
-rw-r--r-- | KeyRing.hs | 15 |
1 files changed, 8 insertions, 7 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) |