diff options
author | Joe Crayne <joe@jerkface.net> | 2019-07-15 18:45:45 -0400 |
---|---|---|
committer | Joe Crayne <joe@jerkface.net> | 2019-07-15 18:45:45 -0400 |
commit | c54b35e665f2a8ec2fff484de99fd59b0454dcff (patch) | |
tree | 3d044266ba6e75098e2cb4fe061bf0bb8d666cac /kiki.hs | |
parent | da8e9689ce6df97b0bde086f14e40a4e096d2a8f (diff) |
Switched fingerprint to wrapped ByteString + some module shuffling.
Diffstat (limited to 'kiki.hs')
-rw-r--r-- | kiki.hs | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -72,7 +72,7 @@ isCertificationSig _ = True | |||
72 | fpmatch :: Maybe [Char] -> Packet -> Bool | 72 | fpmatch :: Maybe [Char] -> Packet -> Bool |
73 | fpmatch grip key = | 73 | fpmatch grip key = |
74 | (==) Nothing | 74 | (==) Nothing |
75 | (fmap (backend (fingerprint key)) grip >>= guard . not) | 75 | (fmap (backend (show $ fingerprint key)) grip >>= guard . not) |
76 | where | 76 | where |
77 | backend xs ys = and $ zipWith (==) (reverse xs) (reverse ys) | 77 | backend xs ys = and $ zipWith (==) (reverse xs) (reverse ys) |
78 | 78 | ||
@@ -105,11 +105,11 @@ listKeysFiltered grips pkts = do | |||
105 | matchgrip ((code,(top,sub), kind, hashed,claimants):_) | any (flip fpmatch top . Just) grips = True | 105 | matchgrip ((code,(top,sub), kind, hashed,claimants):_) | any (flip fpmatch top . Just) grips = True |
106 | matchgrip _ = False | 106 | matchgrip _ = False |
107 | gs = filter matchgrip $ groupBy sameMaster (sortBy (comparing code) as) | 107 | gs = filter matchgrip $ groupBy sameMaster (sortBy (comparing code) as) |
108 | singles = filter (\k -> fingerprint k `notElem` map fingerprint parents) masterkeys -- \\ parents | 108 | singles = filter (\k -> show (fingerprint k) `notElem` map (show . fingerprint) parents) masterkeys -- \\ parents |
109 | where parents = do | 109 | where parents = do |
110 | subs@((_,(top,_),_,_,_):_) <- gs | 110 | subs@((_,(top,_),_,_,_):_) <- gs |
111 | return top | 111 | return top |
112 | showsigs claimants = map (\k -> " " ++ "^ signed: " ++ fingerprint k) claimants | 112 | showsigs claimants = map (\k -> " " ++ "^ signed: " ++ show (fingerprint k)) claimants |
113 | subs0 <- map Left gs ++ map Right singles | 113 | subs0 <- map Left gs ++ map Right singles |
114 | let (top,subs) = case subs0 of Left subs1@((_,(top0,_),_,_,_):_) -> (top0,subs1) | 114 | let (top,subs) = case subs0 of Left subs1@((_,(top0,_),_,_,_):_) -> (top0,subs1) |
115 | Right top0 -> (top0,[]) | 115 | Right top0 -> (top0,[]) |
@@ -133,7 +133,7 @@ listKeysFiltered grips pkts = do | |||
133 | , ar | 133 | , ar |
134 | , formkind | 134 | , formkind |
135 | , " " | 135 | , " " |
136 | , fingerprint sub | 136 | , show $ fingerprint sub |
137 | , kcipher sub | 137 | , kcipher sub |
138 | -- , " " ++ (torhash sub) | 138 | -- , " " ++ (torhash sub) |
139 | -- , " " ++ (concatMap (printf "%02X") $ S.unpack (ecc_curve sub)) | 139 | -- , " " ++ (concatMap (printf "%02X") $ S.unpack (ecc_curve sub)) |
@@ -179,7 +179,7 @@ listKeysFiltered grips pkts = do | |||
179 | listToMaybe $ filter match torkeys | 179 | listToMaybe $ filter match torkeys |
180 | unlines $ (" " ++ ar ++ "@" ++ " " ++ uid_full parsed) : showsigs secondary | 180 | unlines $ (" " ++ ar ++ "@" ++ " " ++ uid_full parsed) : showsigs secondary |
181 | -- (_,sigs) = unzip certs | 181 | -- (_,sigs) = unzip certs |
182 | "master-key " ++ fingerprint top ++ kcipher top ++ "\n" ++ uid ++" ...\n" ++ subkeys ++ "\n" | 182 | "master-key " ++ show (fingerprint top) ++ kcipher top ++ "\n" ++ uid ++" ...\n" ++ subkeys ++ "\n" |
183 | 183 | ||
184 | 184 | ||
185 | {- | 185 | {- |
@@ -258,7 +258,7 @@ show_whose_key input_key db = | |||
258 | let ks = whoseKey input_key db | 258 | let ks = whoseKey input_key db |
259 | case ks of | 259 | case ks of |
260 | [KeyData k _ uids _] -> do | 260 | [KeyData k _ uids _] -> do |
261 | putStrLn $ fingerprint (packet k) | 261 | putStrLn $ show $ fingerprint (packet k) |
262 | mapM_ putStrLn $ unUidString <$> Map.keys uids | 262 | mapM_ putStrLn $ unUidString <$> Map.keys uids |
263 | (_:_) -> error "ambiguous" | 263 | (_:_) -> error "ambiguous" |
264 | [] -> return () | 264 | [] -> return () |
@@ -1762,7 +1762,7 @@ tarC (sargs,margs) = do | |||
1762 | case r of | 1762 | case r of |
1763 | KikiSuccess p -> return $ Just p | 1763 | KikiSuccess p -> return $ Just p |
1764 | _ -> do | 1764 | _ -> do |
1765 | hPutStrLn stderr $ "Failed to decrypt "++fingerprint k++"." | 1765 | hPutStrLn stderr $ "Failed to decrypt "++show (fingerprint k) ++ "." |
1766 | return Nothing | 1766 | return Nothing |
1767 | -- | | 1767 | -- | |
1768 | -- | 1768 | -- |