diff options
Diffstat (limited to 'KeyRing.hs')
-rw-r--r-- | KeyRing.hs | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -1151,6 +1151,7 @@ isCryptoCoinKey p = | |||
1151 | , lookup 'c' (key p) == Just (MPI secp256k1_id) | 1151 | , lookup 'c' (key p) == Just (MPI secp256k1_id) |
1152 | ] | 1152 | ] |
1153 | 1153 | ||
1154 | getCryptoCoinTag :: Packet -> Maybe CryptoCoins.CoinNetwork | ||
1154 | getCryptoCoinTag p | isSignaturePacket p = do | 1155 | getCryptoCoinTag p | isSignaturePacket p = do |
1155 | -- CryptoCoins.secret | 1156 | -- CryptoCoins.secret |
1156 | let sps = hashed_subpackets p ++ unhashed_subpackets p | 1157 | let sps = hashed_subpackets p ++ unhashed_subpackets p |
@@ -1170,6 +1171,7 @@ coinKeysOwnedBy db wk = do | |||
1170 | tag <- take 1 $ mapMaybe getCryptoCoinTag (map (packet . fst) sigs) | 1171 | tag <- take 1 $ mapMaybe getCryptoCoinTag (map (packet . fst) sigs) |
1171 | return (tag,mp) | 1172 | return (tag,mp) |
1172 | 1173 | ||
1174 | walletImportFormat :: Word8 -> Packet -> String | ||
1173 | walletImportFormat idbyte k = secret_base58_foo | 1175 | walletImportFormat idbyte k = secret_base58_foo |
1174 | where | 1176 | where |
1175 | -- isSecret (SecretKeyPacket {}) = True | 1177 | -- isSecret (SecretKeyPacket {}) = True |
@@ -1206,6 +1208,7 @@ writeWalletKeys krd db wk = do | |||
1206 | report <- foldM writeWallet [] (files isMutableWallet) | 1208 | report <- foldM writeWallet [] (files isMutableWallet) |
1207 | return $ KikiSuccess report | 1209 | return $ KikiSuccess report |
1208 | 1210 | ||
1211 | ifSecret :: Packet -> t -> t -> t | ||
1209 | ifSecret (SecretKeyPacket {}) t f = t | 1212 | ifSecret (SecretKeyPacket {}) t f = t |
1210 | ifSecret _ t f = f | 1213 | ifSecret _ t f = f |
1211 | 1214 | ||
@@ -1219,8 +1222,13 @@ showPacket p | isKey p = (if is_subkey p | |||
1219 | showPacket0 p = concat . take 1 $ words (show p) | 1222 | showPacket0 p = concat . take 1 $ words (show p) |
1220 | 1223 | ||
1221 | 1224 | ||
1225 | importPublic :: Maybe Bool | ||
1222 | importPublic = Just True | 1226 | importPublic = Just True |
1227 | |||
1228 | importSecret :: Maybe Bool | ||
1223 | importSecret = Just False | 1229 | importSecret = Just False |
1230 | |||
1231 | subkeysOnly :: Maybe Bool | ||
1224 | subkeysOnly = Nothing | 1232 | subkeysOnly = Nothing |
1225 | 1233 | ||
1226 | guardAuthentic :: KeyRingRuntime -> KeyData -> Maybe () | 1234 | guardAuthentic :: KeyRingRuntime -> KeyData -> Maybe () |
@@ -1299,6 +1307,7 @@ getSubkeysForExport kk subspec db = do | |||
1299 | subkeysForExport subspec kd | 1307 | subkeysForExport subspec kd |
1300 | -} | 1308 | -} |
1301 | 1309 | ||
1310 | subkeysForExport :: Maybe String -> KeyData -> [MappedPacket] | ||
1302 | subkeysForExport subspec (KeyData key _ _ subkeys) = do | 1311 | subkeysForExport subspec (KeyData key _ _ subkeys) = do |
1303 | let subs tag = do | 1312 | let subs tag = do |
1304 | e <- Map.elems subkeys | 1313 | e <- Map.elems subkeys |
@@ -1313,6 +1322,7 @@ subkeysForExport subspec (KeyData key _ _ subkeys) = do | |||
1313 | sigtrusts | 1322 | sigtrusts |
1314 | in fmap fst v==Just True | 1323 | in fmap fst v==Just True |
1315 | 1324 | ||
1325 | writePEM :: String -> String -> String | ||
1316 | writePEM typ dta = pem | 1326 | writePEM typ dta = pem |
1317 | where | 1327 | where |
1318 | pem = unlines . concat $ | 1328 | pem = unlines . concat $ |
@@ -1354,6 +1364,8 @@ rsaPrivateKeyFromPacket pkt@(SecretKeyPacket {}) = do | |||
1354 | rsaPrivateKeyFromPacket _ = Nothing | 1364 | rsaPrivateKeyFromPacket _ = Nothing |
1355 | 1365 | ||
1356 | 1366 | ||
1367 | writeKeyToFile :: | ||
1368 | Bool -> String -> FilePath -> Packet -> IO [(FilePath, KikiReportAction)] | ||
1357 | writeKeyToFile False "PEM" fname packet = | 1369 | writeKeyToFile False "PEM" fname packet = |
1358 | case key_algorithm packet of | 1370 | case key_algorithm packet of |
1359 | RSA -> do | 1371 | RSA -> do |