From d8864bdadf2d1fd2847806c63124c1e7f1df2d9f Mon Sep 17 00:00:00 2001 From: joe Date: Sat, 9 Nov 2013 19:38:56 -0500 Subject: Ability to output PEM for public keys not in secring.gpg. --- kiki.hs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/kiki.hs b/kiki.hs index b55510f..1953611 100644 --- a/kiki.hs +++ b/kiki.hs @@ -1277,8 +1277,8 @@ main = do (toptyp,top) = unprefix ':' topspec (subtyp,sub) = unprefix ':' subspec - {- putStrLn $ "files = " ++ show files + {- putStrLn $ "topspec = " ++show (toptyp,top) putStrLn $ "subspec = " ++show (subtyp,sub) -} @@ -1289,11 +1289,19 @@ main = do flip (maybe (error "No working key?")) grip $ \grip -> do + ms <- mapM readPacketsFromFile files + let db = merge Map.empty (Message sec) + db' = foldl' merge db ms + m = flattenKeys db' + Message allpkts = m + let topspec = case () of _ | null top -> {- trace "using grip" $ -} KeyGrip grip _ | is40digitHex top -> {- trace "using top" $ -} KeyGrip top _ | otherwise -> todo - (pre, wk:subs) = seek_key topspec sec + (pre, wksubs) = seek_key topspec allpkts + if null wksubs then error ("No match for "++spec) else do + let wk:subs = wksubs (xs,ys) = seek_key (KeyTag wk sub) subs when (not (null ys)) $ do let (xs',ys') = seek_key (KeyTag wk sub) (tail ys) @@ -1565,6 +1573,7 @@ seek_key (KeyGrip grip) sec = (pre, subs) where (pre,subs) = break pred sec pred p@(SecretKeyPacket {}) = matchpr grip p == grip + pred p@(PublicKeyPacket {}) = matchpr grip p == grip pred _ = False seek_key (KeyTag key tag) ps = if null bs -- cgit v1.2.3