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/Types.hs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'lib/KeyRing/Types.hs') 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