diff options
author | Joe Crayne <joe@jerkface.net> | 2019-07-02 03:33:29 -0400 |
---|---|---|
committer | Joe Crayne <joe@jerkface.net> | 2019-07-02 03:33:29 -0400 |
commit | b472f10fb19182deb4c081940cd1e660a0287fe9 (patch) | |
tree | 370f8bc5f5b3a4819224d221399f2b65fa5fbedf | |
parent | 5d5ce0e97107619b8e33c76585d7629f106ad3c8 (diff) |
Changed KeyKey to avoid serializing bignums.
-rw-r--r-- | lib/KeyRing/BuildKeyDB.hs | 6 | ||||
-rw-r--r-- | lib/KeyRing/Types.hs | 13 |
2 files changed, 7 insertions, 12 deletions
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 | |||
126 | ,{- hs -} ({- hostdbs0 -}[Hosts.Hosts], | 126 | ,{- hs -} ({- hostdbs0 -}[Hosts.Hosts], |
127 | {- hostdbs -}[Hosts.Hosts], | 127 | {- hostdbs -}[Hosts.Hosts], |
128 | {- u1 -}Hosts.Hosts, | 128 | {- u1 -}Hosts.Hosts, |
129 | {- gpgnames -}[(SockAddr, (KeyKey, KeyKey))], | 129 | {- gpgnames -}[(SockAddr, ([ByteString],[ByteString]))], |
130 | {- outgoing_names -}[SockAddr]) | 130 | {- outgoing_names -}[SockAddr]) |
131 | ,{- accs -} Map.Map InputFile Access | 131 | ,{- accs -} Map.Map InputFile Access |
132 | ,{- doDecrypt -} PacketTranscoder | 132 | ,{- transcode -} PacketTranscoder |
133 | ,{- unspilled -} Map.Map InputFile Message | 133 | ,{- unspilled -} Map.Map InputFile Message |
134 | ) | 134 | ) |
135 | ,{- report_imports -} [(FilePath,KikiReportAction)])) | 135 | ,{- report_imports -} [(FilePath,KikiReportAction)])) |
@@ -544,7 +544,7 @@ generateInternals transcode mwk db gens = do | |||
544 | mergeHostFiles :: KeyRingOperation -> KeyDB -> InputFileContext | 544 | mergeHostFiles :: KeyRingOperation -> KeyDB -> InputFileContext |
545 | -> IO | 545 | -> IO |
546 | (KikiCondition | 546 | (KikiCondition |
547 | ( ( Map.Map [Char8.ByteString] KeyData | 547 | ( ( KeyDB |
548 | , ( [Hosts.Hosts] | 548 | , ( [Hosts.Hosts] |
549 | , [Hosts.Hosts] | 549 | , [Hosts.Hosts] |
550 | , Hosts.Hosts | 550 | , 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 @@ | |||
2 | module KeyRing.Types where | 2 | module KeyRing.Types where |
3 | 3 | ||
4 | import Data.Char (isLower,toLower) | 4 | import Data.Char (isLower,toLower) |
5 | import Data.List (groupBy) | 5 | import Data.List (groupBy,find) |
6 | import Data.Map as Map (Map) | 6 | import Data.Map as Map (Map) |
7 | import qualified Data.Map as Map | 7 | import qualified Data.Map as Map |
8 | import Data.Maybe (maybeToList) | ||
8 | import Data.OpenPGP | 9 | import Data.OpenPGP |
9 | import Data.OpenPGP.Util | 10 | import Data.OpenPGP.Util |
10 | import Data.Time.Clock | 11 | import Data.Time.Clock |
@@ -298,16 +299,10 @@ data InputFileContext = InputFileContext | |||
298 | -- which is used for finger-printing and as a lookup key into | 299 | -- which is used for finger-printing and as a lookup key into |
299 | -- maps. This type may be changed to an actual fingerprint in | 300 | -- maps. This type may be changed to an actual fingerprint in |
300 | -- in the future. | 301 | -- in the future. |
301 | type KeyKey = [L.ByteString] | 302 | type KeyKey = [(Char,MPI)] |
302 | 303 | ||
303 | keykey :: Packet -> KeyKey | 304 | keykey :: Packet -> KeyKey |
304 | keykey key = | 305 | keykey k = concatMap (\c -> (maybeToList $ find (\(f,x) -> f==c) (key k))) (public_key_fields $ key_algorithm k) |
305 | -- Note: The key's timestamp is normally included in it's fingerprint. | ||
306 | -- This is undesirable for kiki because it causes the same | ||
307 | -- key to be imported multiple times and show as apparently | ||
308 | -- distinct keys with different fingerprints. | ||
309 | -- Thus, we will remove the timestamp. | ||
310 | fingerprint_material (key {timestamp=0}) -- TODO: smaller key? | ||
311 | 306 | ||
312 | isKey :: Packet -> Bool | 307 | isKey :: Packet -> Bool |
313 | isKey (PublicKeyPacket {}) = True | 308 | isKey (PublicKeyPacket {}) = True |