summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2016-08-25 12:41:59 -0400
committerjoe <joe@jerkface.net>2016-08-25 12:41:59 -0400
commit26d215428efbe6447ae319ae3bbfa7d39209688e (patch)
treed693b66a860eb87eb2c1dec6e4dbc1975c91583e
parentaea085761eeaeb0debc1373aeb7edee25c3120a5 (diff)
Show cipher for password-protected keys.
-rw-r--r--kiki.hs5
-rw-r--r--lib/KeyRing.hs5
-rw-r--r--lib/Kiki.hs6
3 files changed, 14 insertions, 2 deletions
diff --git a/kiki.hs b/kiki.hs
index eabfbf3..854bf23 100644
--- a/kiki.hs
+++ b/kiki.hs
@@ -194,6 +194,7 @@ listKeysFiltered grips pkts = do
194 , formkind 194 , formkind
195 , " " 195 , " "
196 , fingerprint sub 196 , fingerprint sub
197 , kcipher sub
197 -- , " " ++ (torhash sub) 198 -- , " " ++ (torhash sub)
198 -- , " " ++ (concatMap (printf "%02X") $ S.unpack (ecc_curve sub)) 199 -- , " " ++ (concatMap (printf "%02X") $ S.unpack (ecc_curve sub))
199 ] -- ++ ppShow hashed 200 ] -- ++ ppShow hashed
@@ -202,6 +203,8 @@ listKeysFiltered grips pkts = do
202 -- then (" " ++ "BTC " ++ bitcoinAddress sub) : showsigs claimants 203 -- then (" " ++ "BTC " ++ bitcoinAddress sub) : showsigs claimants
203 then (" " ++ "¢ "++kind'++":" ++ bitcoinAddress netid sub) : showsigs claimants 204 then (" " ++ "¢ "++kind'++":" ++ bitcoinAddress netid sub) : showsigs claimants
204 else showsigs claimants 205 else showsigs claimants
206 kcipher k = if isSecretKey k then " " ++ ciphername (symmetric_algorithm k)
207 else ""
205 torkeys = do 208 torkeys = do
206 (code,(top,sub), kind, hashed,claimants) <- subs 209 (code,(top,sub), kind, hashed,claimants) <- subs
207 guard ("tor" `elem` kind) 210 guard ("tor" `elem` kind)
@@ -236,7 +239,7 @@ listKeysFiltered grips pkts = do
236 listToMaybe $ filter match torkeys 239 listToMaybe $ filter match torkeys
237 unlines $ (" " ++ ar ++ "@" ++ " " ++ uid_full parsed) : showsigs secondary 240 unlines $ (" " ++ ar ++ "@" ++ " " ++ uid_full parsed) : showsigs secondary
238 -- (_,sigs) = unzip certs 241 -- (_,sigs) = unzip certs
239 "master-key " ++ fingerprint top ++ "\n" ++ uid ++" ...\n" ++ subkeys ++ "\n" 242 "master-key " ++ fingerprint top ++ kcipher top ++ "\n" ++ uid ++" ...\n" ++ subkeys ++ "\n"
240 243
241 244
242{- 245{-
diff --git a/lib/KeyRing.hs b/lib/KeyRing.hs
index 80b7826..4e83d80 100644
--- a/lib/KeyRing.hs
+++ b/lib/KeyRing.hs
@@ -54,6 +54,7 @@ module KeyRing
54 , keyflags 54 , keyflags
55 -- * Miscelaneous Utilities 55 -- * Miscelaneous Utilities
56 , isKey 56 , isKey
57 , isSecretKey
57 , derRSA 58 , derRSA
58 , derToBase32 59 , derToBase32
59 , backsig 60 , backsig
@@ -2570,7 +2571,9 @@ makeMemoizingDecrypter operation ctx keys = do
2570 case symmetric_algorithm wkun of 2571 case symmetric_algorithm wkun of
2571 Unencrypted -> do 2572 Unencrypted -> do
2572 writeIORef unkeysRef (Map.insert kk wkun unkeys) 2573 writeIORef unkeysRef (Map.insert kk wkun unkeys)
2573 ek <- encryptSecretKey pw dest_s2k dest_alg wkun 2574 ek <- if dest_alg==Unencrypted
2575 then return $ Just wkun
2576 else encryptSecretKey pw dest_s2k dest_alg wkun
2574 case ek of 2577 case ek of
2575 Nothing -> return $ BadPassphrase 2578 Nothing -> return $ BadPassphrase
2576 Just wken -> return $ KikiSuccess wken 2579 Just wken -> return $ KikiSuccess wken
diff --git a/lib/Kiki.hs b/lib/Kiki.hs
index 3bc6330..f1bb27d 100644
--- a/lib/Kiki.hs
+++ b/lib/Kiki.hs
@@ -10,6 +10,7 @@ import Data.ASN1.BinaryEncoding
10import Data.ASN1.Encoding 10import Data.ASN1.Encoding
11import Data.ASN1.Types 11import Data.ASN1.Types
12import Data.Binary 12import Data.Binary
13import Data.Char
13import Data.List 14import Data.List
14import Data.Maybe 15import Data.Maybe
15import Data.Monoid 16import Data.Monoid
@@ -35,6 +36,11 @@ import CommandLine
35import KeyRing 36import KeyRing
36import DotLock 37import DotLock
37 38
39ciphername Unencrypted = "-"
40ciphername TripleDES = "3des"
41ciphername (SymmetricAlgorithm w8) = "cipher-"++show w8
42ciphername c = map toLower $ show c
43
38-- | 44-- |
39-- Regenerate /var/cache/kiki 45-- Regenerate /var/cache/kiki
40refresh :: (FilePath -> FilePath) -> CommonArgsParsed -> IO () 46refresh :: (FilePath -> FilePath) -> CommonArgsParsed -> IO ()