From b472f10fb19182deb4c081940cd1e660a0287fe9 Mon Sep 17 00:00:00 2001 From: Joe Crayne Date: Tue, 2 Jul 2019 03:33:29 -0400 Subject: Changed KeyKey to avoid serializing bignums. --- lib/KeyRing/BuildKeyDB.hs | 6 +++--- lib/KeyRing/Types.hs | 13 ++++--------- 2 files changed, 7 insertions(+), 12 deletions(-) (limited to 'lib/KeyRing') diff --git a/lib/KeyRing/BuildKeyDB.hs b/lib/KeyRing/BuildKeyDB.hs index d8f8d50..bae2538 100644 --- a/lib/KeyRing/BuildKeyDB.hs +++ b/lib/KeyRing/BuildKeyDB.hs @@ -126,10 +126,10 @@ buildKeyDB :: InputFileContext -> Maybe String -> KeyRingOperation ,{- hs -} ({- hostdbs0 -}[Hosts.Hosts], {- hostdbs -}[Hosts.Hosts], {- u1 -}Hosts.Hosts, - {- gpgnames -}[(SockAddr, (KeyKey, KeyKey))], + {- gpgnames -}[(SockAddr, ([ByteString],[ByteString]))], {- outgoing_names -}[SockAddr]) ,{- accs -} Map.Map InputFile Access - ,{- doDecrypt -} PacketTranscoder + ,{- transcode -} PacketTranscoder ,{- unspilled -} Map.Map InputFile Message ) ,{- report_imports -} [(FilePath,KikiReportAction)])) @@ -544,7 +544,7 @@ generateInternals transcode mwk db gens = do mergeHostFiles :: KeyRingOperation -> KeyDB -> InputFileContext -> IO (KikiCondition - ( ( Map.Map [Char8.ByteString] KeyData + ( ( KeyDB , ( [Hosts.Hosts] , [Hosts.Hosts] , Hosts.Hosts diff --git a/lib/KeyRing/Types.hs b/lib/KeyRing/Types.hs index 2383140..e1e19f5 100644 --- a/lib/KeyRing/Types.hs +++ b/lib/KeyRing/Types.hs @@ -2,9 +2,10 @@ module KeyRing.Types where import Data.Char (isLower,toLower) -import Data.List (groupBy) +import Data.List (groupBy,find) import Data.Map as Map (Map) import qualified Data.Map as Map +import Data.Maybe (maybeToList) import Data.OpenPGP import Data.OpenPGP.Util import Data.Time.Clock @@ -298,16 +299,10 @@ data InputFileContext = InputFileContext -- which is used for finger-printing and as a lookup key into -- maps. This type may be changed to an actual fingerprint in -- in the future. -type KeyKey = [L.ByteString] +type KeyKey = [(Char,MPI)] keykey :: Packet -> KeyKey -keykey key = - -- Note: The key's timestamp is normally included in it's fingerprint. - -- This is undesirable for kiki because it causes the same - -- key to be imported multiple times and show as apparently - -- distinct keys with different fingerprints. - -- Thus, we will remove the timestamp. - fingerprint_material (key {timestamp=0}) -- TODO: smaller key? +keykey k = concatMap (\c -> (maybeToList $ find (\(f,x) -> f==c) (key k))) (public_key_fields $ key_algorithm k) isKey :: Packet -> Bool isKey (PublicKeyPacket {}) = True -- cgit v1.2.3