diff options
author | joe <joe@jerkface.net> | 2016-08-25 12:41:59 -0400 |
---|---|---|
committer | joe <joe@jerkface.net> | 2016-08-25 12:41:59 -0400 |
commit | 26d215428efbe6447ae319ae3bbfa7d39209688e (patch) | |
tree | d693b66a860eb87eb2c1dec6e4dbc1975c91583e | |
parent | aea085761eeaeb0debc1373aeb7edee25c3120a5 (diff) |
Show cipher for password-protected keys.
-rw-r--r-- | kiki.hs | 5 | ||||
-rw-r--r-- | lib/KeyRing.hs | 5 | ||||
-rw-r--r-- | lib/Kiki.hs | 6 |
3 files changed, 14 insertions, 2 deletions
@@ -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 | |||
10 | import Data.ASN1.Encoding | 10 | import Data.ASN1.Encoding |
11 | import Data.ASN1.Types | 11 | import Data.ASN1.Types |
12 | import Data.Binary | 12 | import Data.Binary |
13 | import Data.Char | ||
13 | import Data.List | 14 | import Data.List |
14 | import Data.Maybe | 15 | import Data.Maybe |
15 | import Data.Monoid | 16 | import Data.Monoid |
@@ -35,6 +36,11 @@ import CommandLine | |||
35 | import KeyRing | 36 | import KeyRing |
36 | import DotLock | 37 | import DotLock |
37 | 38 | ||
39 | ciphername Unencrypted = "-" | ||
40 | ciphername TripleDES = "3des" | ||
41 | ciphername (SymmetricAlgorithm w8) = "cipher-"++show w8 | ||
42 | ciphername c = map toLower $ show c | ||
43 | |||
38 | -- | | 44 | -- | |
39 | -- Regenerate /var/cache/kiki | 45 | -- Regenerate /var/cache/kiki |
40 | refresh :: (FilePath -> FilePath) -> CommonArgsParsed -> IO () | 46 | refresh :: (FilePath -> FilePath) -> CommonArgsParsed -> IO () |