diff options
-rw-r--r-- | KeyRing.hs | 19 |
1 files changed, 16 insertions, 3 deletions
@@ -479,6 +479,9 @@ buildKeyDB secring pubring grip0 keyring = do | |||
479 | let isring (KeyRingFile {}) = True | 479 | let isring (KeyRingFile {}) = True |
480 | isring _ = False | 480 | isring _ = False |
481 | 481 | ||
482 | getUsage (PEMFile usage) = return usage | ||
483 | getUsage _ = mzero | ||
484 | |||
482 | iswallet WalletFile = True | 485 | iswallet WalletFile = True |
483 | iswallet _ = False | 486 | iswallet _ = False |
484 | 487 | ||
@@ -526,13 +529,23 @@ buildKeyDB secring pubring grip0 keyring = do | |||
526 | try r $ \(db'',report) -> do | 529 | try r $ \(db'',report) -> do |
527 | return $ KikiSuccess (db'', report0 ++ report) | 530 | return $ KikiSuccess (db'', report0 ++ report) |
528 | 531 | ||
532 | importPEMKey db' tup = do | ||
533 | try db' $ \(db',report0) -> do | ||
534 | r <- doImport doDecrypt | ||
535 | db' | ||
536 | tup | ||
537 | try r $ \(db'',report) -> do | ||
538 | return $ KikiSuccess (db'', report0 ++ report) | ||
539 | |||
529 | db <- foldM importWalletKey (KikiSuccess (db_rings,[])) wallet_keys | 540 | db <- foldM importWalletKey (KikiSuccess (db_rings,[])) wallet_keys |
530 | try db $ \(db,report) -> do | 541 | try db $ \(db,reportWallets) -> do |
531 | 542 | ||
532 | -- todo: import PEMFiles | 543 | -- todo: import PEMFiles |
533 | -- use_db <- foldM (doImport decrypt) use_db0 (map snd imports) | 544 | let imports = todo |
545 | db <- foldM importPEMKey (KikiSuccess (db,[])) (map snd imports) | ||
546 | try db $ \(db,reportPEMs) -> do | ||
534 | 547 | ||
535 | return $ KikiSuccess ( (db, grip, wk), report ) | 548 | return $ KikiSuccess ( (db, grip, wk), reportWallets ++ reportPEMs ) |
536 | 549 | ||
537 | torhash key = maybe "" id $ derToBase32 <$> derRSA key | 550 | torhash key = maybe "" id $ derToBase32 <$> derRSA key |
538 | 551 | ||