diff options
-rw-r--r-- | kiki.hs | 2 | ||||
-rw-r--r-- | lib/KeyRing.hs | 2 | ||||
-rw-r--r-- | lib/KeyRing/BuildKeyDB.hs | 29 | ||||
-rw-r--r-- | lib/Kiki.hs | 4 |
4 files changed, 4 insertions, 33 deletions
@@ -1548,7 +1548,7 @@ kiki "init" args | "--help" `elem` args = do | |||
1548 | , "" | 1548 | , "" |
1549 | ] ++ documentHomeDir ++ [""] ++ documentPassphraseFDFlag True True True | 1549 | ] ++ documentHomeDir ++ [""] ++ documentPassphraseFDFlag True True True |
1550 | 1550 | ||
1551 | kiki "init" args = run args $ importAndRefresh <$> opt_chroot <*> opt_homedir <*> opt_cipher | 1551 | kiki "init" args = run args $ importAndRefresh <$> dashdashChroot <*> dashdashHomedir <*> dashdashCipher |
1552 | 1552 | ||
1553 | kiki "delete" args | "--help" `elem` args = do | 1553 | kiki "delete" args | "--help" `elem` args = do |
1554 | putStr . unlines $ | 1554 | putStr . unlines $ |
diff --git a/lib/KeyRing.hs b/lib/KeyRing.hs index 69410ad..2c6b782 100644 --- a/lib/KeyRing.hs +++ b/lib/KeyRing.hs | |||
@@ -24,7 +24,7 @@ | |||
24 | {-# LANGUAGE PatternGuards #-} | 24 | {-# LANGUAGE PatternGuards #-} |
25 | {-# LANGUAGE ForeignFunctionInterface #-} | 25 | {-# LANGUAGE ForeignFunctionInterface #-} |
26 | {-# LANGUAGE LambdaCase #-} | 26 | {-# LANGUAGE LambdaCase #-} |
27 | module KeyRing (module KeyRing.Types, module KeyRing, module KeyRing.BuildKeyDB) where | 27 | module KeyRing (module KeyRing.Types, module Transforms, module PacketTranscoder, module KeyRing, module KeyRing.BuildKeyDB) where |
28 | 28 | ||
29 | import System.Environment | 29 | import System.Environment |
30 | import Control.Monad | 30 | import Control.Monad |
diff --git a/lib/KeyRing/BuildKeyDB.hs b/lib/KeyRing/BuildKeyDB.hs index 6de217b..d8f8d50 100644 --- a/lib/KeyRing/BuildKeyDB.hs +++ b/lib/KeyRing/BuildKeyDB.hs | |||
@@ -1042,17 +1042,6 @@ secp256k1_id = 0x2b8104000a | |||
1042 | -} | 1042 | -} |
1043 | 1043 | ||
1044 | 1044 | ||
1045 | keyCompare :: String -> Packet -> Packet -> Ordering | ||
1046 | keyCompare what (SecretKeyPacket {}) (PublicKeyPacket {}) = LT | ||
1047 | keyCompare what (PublicKeyPacket {}) (SecretKeyPacket {}) = GT | ||
1048 | keyCompare what a b | keykey a==keykey b = EQ | ||
1049 | keyCompare what a b = error $ unlines ["Unable to merge "++what++":" | ||
1050 | , fingerprint a | ||
1051 | , PP.ppShow a | ||
1052 | , fingerprint b | ||
1053 | , PP.ppShow b | ||
1054 | ] | ||
1055 | |||
1056 | 1045 | ||
1057 | dbInsertPacket :: KeyData -> FilePath -> (Int,(Packet,Packet,(Packet,Map.Map FilePath Packet))) -> Maybe KeyData | 1046 | dbInsertPacket :: KeyData -> FilePath -> (Int,(Packet,Packet,(Packet,Map.Map FilePath Packet))) -> Maybe KeyData |
1058 | dbInsertPacket kd filename (n,(top,sub,ptt@(p,trustmap))) = update (Just kd) | 1047 | dbInsertPacket kd filename (n,(top,sub,ptt@(p,trustmap))) = update (Just kd) |
@@ -1119,24 +1108,6 @@ dbInsertPacket kd filename (n,(top,sub,ptt@(p,trustmap))) = update (Just kd) | |||
1119 | mergeSubSig n sig Nothing = error $ | 1108 | mergeSubSig n sig Nothing = error $ |
1120 | "Unable to merge subkey signature: "++(words (show sig) >>= take 1) | 1109 | "Unable to merge subkey signature: "++(words (show sig) >>= take 1) |
1121 | 1110 | ||
1122 | secretToPublic :: Packet -> Packet | ||
1123 | secretToPublic pkt@(SecretKeyPacket {}) = | ||
1124 | PublicKeyPacket { version = version pkt | ||
1125 | , timestamp = timestamp pkt | ||
1126 | , key_algorithm = key_algorithm pkt | ||
1127 | -- , ecc_curve = ecc_curve pkt | ||
1128 | , key = let seckey = key pkt | ||
1129 | pubs = public_key_fields (key_algorithm pkt) | ||
1130 | in filter (\(k,v) -> k `elem` pubs) seckey | ||
1131 | , is_subkey = is_subkey pkt | ||
1132 | , v3_days_of_validity = Nothing | ||
1133 | } | ||
1134 | secretToPublic pkt = pkt | ||
1135 | |||
1136 | |||
1137 | ifSecret :: Packet -> t -> t -> t | ||
1138 | ifSecret (SecretKeyPacket {}) t f = t | ||
1139 | ifSecret _ t f = f | ||
1140 | 1111 | ||
1141 | instance ASN1Object RSAPrivateKey where | 1112 | instance ASN1Object RSAPrivateKey where |
1142 | toASN1 rsa@(RSAPrivateKey {}) | 1113 | toASN1 rsa@(RSAPrivateKey {}) |
diff --git a/lib/Kiki.hs b/lib/Kiki.hs index 27ebbcd..828a251 100644 --- a/lib/Kiki.hs +++ b/lib/Kiki.hs | |||
@@ -45,7 +45,7 @@ import qualified SSHKey as SSH | |||
45 | import CommandLine | 45 | import CommandLine |
46 | import DotLock | 46 | import DotLock |
47 | import GnuPGAgent (Query (..)) | 47 | import GnuPGAgent (Query (..)) |
48 | import KeyRing | 48 | import KeyRing hiding (pemFromPacket) |
49 | 49 | ||
50 | withAgent :: [PassphraseSpec] -> [PassphraseSpec] | 50 | withAgent :: [PassphraseSpec] -> [PassphraseSpec] |
51 | withAgent [] = [PassphraseAgent] | 51 | withAgent [] = [PassphraseAgent] |
@@ -171,7 +171,7 @@ importAndRefresh root cmn cipher = do | |||
171 | 171 | ||
172 | let passfd = cap_passfd cmn | 172 | let passfd = cap_passfd cmn |
173 | 173 | ||
174 | (torgen,pwds) <- bool id (const $ return (Generate 0 $ GenRSA $ 1024 `div` 8, [])) $ do | 174 | (torgen,pwds) <- bool id (const $ return (Generate 0 $ GenRSA $ 1024 `div` 8, [])) gotsec $ do |
175 | {- ssh-keygen to create master key... | 175 | {- ssh-keygen to create master key... |
176 | let mkpath = home ++ "/master-key" | 176 | let mkpath = home ++ "/master-key" |
177 | mkdirFor mkpath | 177 | mkdirFor mkpath |