diff options
author | joe <joe@jerkface.net> | 2014-04-15 18:46:03 -0400 |
---|---|---|
committer | joe <joe@jerkface.net> | 2014-04-15 18:46:03 -0400 |
commit | adab31d826113207bca7f4f7f9fb8013cead0ce1 (patch) | |
tree | b84f18ce03b310ef8248839da35d66a7b6bd257c /KeyRing.hs | |
parent | 27961dacaf2806581c79d26c287d340d596f890b (diff) |
work in progress importing PEM files
Diffstat (limited to 'KeyRing.hs')
-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 | ||