summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kiki.hs2
-rw-r--r--lib/KeyRing.hs2
-rw-r--r--lib/KeyRing/BuildKeyDB.hs29
-rw-r--r--lib/Kiki.hs4
4 files changed, 4 insertions, 33 deletions
diff --git a/kiki.hs b/kiki.hs
index e5544e5..fa22451 100644
--- a/kiki.hs
+++ b/kiki.hs
@@ -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
1551kiki "init" args = run args $ importAndRefresh <$> opt_chroot <*> opt_homedir <*> opt_cipher 1551kiki "init" args = run args $ importAndRefresh <$> dashdashChroot <*> dashdashHomedir <*> dashdashCipher
1552 1552
1553kiki "delete" args | "--help" `elem` args = do 1553kiki "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 #-}
27module KeyRing (module KeyRing.Types, module KeyRing, module KeyRing.BuildKeyDB) where 27module KeyRing (module KeyRing.Types, module Transforms, module PacketTranscoder, module KeyRing, module KeyRing.BuildKeyDB) where
28 28
29import System.Environment 29import System.Environment
30import Control.Monad 30import 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
1045keyCompare :: String -> Packet -> Packet -> Ordering
1046keyCompare what (SecretKeyPacket {}) (PublicKeyPacket {}) = LT
1047keyCompare what (PublicKeyPacket {}) (SecretKeyPacket {}) = GT
1048keyCompare what a b | keykey a==keykey b = EQ
1049keyCompare 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
1057dbInsertPacket :: KeyData -> FilePath -> (Int,(Packet,Packet,(Packet,Map.Map FilePath Packet))) -> Maybe KeyData 1046dbInsertPacket :: KeyData -> FilePath -> (Int,(Packet,Packet,(Packet,Map.Map FilePath Packet))) -> Maybe KeyData
1058dbInsertPacket kd filename (n,(top,sub,ptt@(p,trustmap))) = update (Just kd) 1047dbInsertPacket 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
1122secretToPublic :: Packet -> Packet
1123secretToPublic 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 }
1134secretToPublic pkt = pkt
1135
1136
1137ifSecret :: Packet -> t -> t -> t
1138ifSecret (SecretKeyPacket {}) t f = t
1139ifSecret _ t f = f
1140 1111
1141instance ASN1Object RSAPrivateKey where 1112instance 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
45import CommandLine 45import CommandLine
46import DotLock 46import DotLock
47import GnuPGAgent (Query (..)) 47import GnuPGAgent (Query (..))
48import KeyRing 48import KeyRing hiding (pemFromPacket)
49 49
50withAgent :: [PassphraseSpec] -> [PassphraseSpec] 50withAgent :: [PassphraseSpec] -> [PassphraseSpec]
51withAgent [] = [PassphraseAgent] 51withAgent [] = [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