summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kiki.hs19
1 files changed, 17 insertions, 2 deletions
diff --git a/kiki.hs b/kiki.hs
index c76a89a..33f8428 100644
--- a/kiki.hs
+++ b/kiki.hs
@@ -793,6 +793,15 @@ data KeySpec =
793 KeyGrip String 793 KeyGrip String
794 | KeyTag Packet String 794 | KeyTag Packet String
795 795
796
797is40digitHex xs = ys == xs && length ys==40
798 where
799 ys = filter ishex xs
800 ishex c | '0' <= c && c <= '9' = True
801 | 'A' <= c && c <= 'F' = True
802 | 'a' <= c && c <= 'f' = True
803 ishex c = False
804
796main = do 805main = do
797 args <- cmdArgs $ modes 806 args <- cmdArgs $ modes
798 [ List HOMEOPTION 807 [ List HOMEOPTION
@@ -1092,7 +1101,11 @@ main = do
1092 1101
1093 flip (maybe (error "No working key?")) grip $ \grip -> do 1102 flip (maybe (error "No working key?")) grip $ \grip -> do
1094 1103
1095 let (pre, wk:subs) = seek_key (KeyGrip grip) sec 1104 let topspec = case () of
1105 _ | null top -> {- trace "using grip" $ -} KeyGrip grip
1106 _ | is40digitHex top -> {- trace "using top" $ -} KeyGrip top
1107 _ | otherwise -> todo
1108 (pre, wk:subs) = seek_key topspec sec
1096 (xs,ys) = seek_key (KeyTag wk sub) subs 1109 (xs,ys) = seek_key (KeyTag wk sub) subs
1097 when (not (null ys)) $ do 1110 when (not (null ys)) $ do
1098 let (xs',ys') = seek_key (KeyTag wk sub) (tail ys) 1111 let (xs',ys') = seek_key (KeyTag wk sub) (tail ys)
@@ -1102,8 +1115,10 @@ main = do
1102 qq = Base64.encode (L.unpack der) 1115 qq = Base64.encode (L.unpack der)
1103 split64 [] = [] 1116 split64 [] = []
1104 split64 qq = as : split64 bs where (as,bs) = splitAt 64 qq 1117 split64 qq = as : split64 bs where (as,bs) = splitAt 64 qq
1118 -- putStrLn $ "top = " ++ show top
1119 -- putStrLn $ "wk = " ++ fingerprint wk
1120 -- putStrLn $ fingerprint k
1105 {- 1121 {-
1106 putStrLn $ fingerprint k
1107 putStrLn $ show rsa 1122 putStrLn $ show rsa
1108 putStrLn $ show der 1123 putStrLn $ show der
1109 -} 1124 -}