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 /lib | |
parent | aea085761eeaeb0debc1373aeb7edee25c3120a5 (diff) |
Show cipher for password-protected keys.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/KeyRing.hs | 5 | ||||
-rw-r--r-- | lib/Kiki.hs | 6 |
2 files changed, 10 insertions, 1 deletions
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 () |