From 71075999e9c7cbcb16220c47c750e859d3ccc7e2 Mon Sep 17 00:00:00 2001 From: Joe Crayne Date: Mon, 18 May 2020 16:48:40 -0400 Subject: Eq/Ord instances for Fingerprint + defaultFeatures packet. --- Data/OpenPGP.hs | 11 ++++++++++- Data/OpenPGP/Util/DecryptSecretKey.hs | 2 +- Data/OpenPGP/Util/Fingerprint.hs | 1 + 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Data/OpenPGP.hs b/Data/OpenPGP.hs index dc6fb78..6140ddf 100644 --- a/Data/OpenPGP.hs +++ b/Data/OpenPGP.hs @@ -75,7 +75,8 @@ module Data.OpenPGP ( decode_public_key_material, getEllipticCurvePublicKey, encodeOID, - hashLen + hashLen, + defaultFeatures ) where import Control.Applicative @@ -1326,6 +1327,14 @@ data SignatureSubpacket = UnsupportedSignatureSubpacket Word8 B.ByteString deriving (Show, Read, Eq) +defaultFeatures :: SignatureSubpacket +defaultFeatures = + FeaturesPacket + { supports_mdc = True + , supports_aead = False + , supports_v5 = True + } + instance BINARY_CLASS SignatureSubpacket where put p = do -- Use 5-octet-length + 1 for tag as the first packet body octet diff --git a/Data/OpenPGP/Util/DecryptSecretKey.hs b/Data/OpenPGP/Util/DecryptSecretKey.hs index 9f9e42a..753cef3 100644 --- a/Data/OpenPGP/Util/DecryptSecretKey.hs +++ b/Data/OpenPGP/Util/DecryptSecretKey.hs @@ -76,7 +76,7 @@ decryptSecretKey pass k@(OpenPGP.SecretKeyPacket { OpenPGP.version = 4, OpenPGP.key_algorithm = kalgo, OpenPGP.s2k = s2k, OpenPGP.symmetric_algorithm = salgo, OpenPGP.key = existing, OpenPGP.encrypted_data = encd - }) | chkF material == LZ.toStrict chk = + }) | chkF material == LZ.toStrict chk = -- TODO: v5 fmap (\m -> k { OpenPGP.s2k_useage = 0, OpenPGP.symmetric_algorithm = OpenPGP.Unencrypted, diff --git a/Data/OpenPGP/Util/Fingerprint.hs b/Data/OpenPGP/Util/Fingerprint.hs index 955748d..422beac 100644 --- a/Data/OpenPGP/Util/Fingerprint.hs +++ b/Data/OpenPGP/Util/Fingerprint.hs @@ -23,6 +23,7 @@ oo :: (b -> c) -> (a -> a1 -> b) -> a -> a1 -> c oo = (.) . (.) newtype Fingerprint = Fingerprint BS.ByteString + deriving (Eq,Ord) instance Show Fingerprint where show fp = hex fp -- cgit v1.2.3