diff --git a/Codec/Encryption/OpenPGP/KeyringParser.hs b/Codec/Encryption/OpenPGP/KeyringParser.hs
--- a/Codec/Encryption/OpenPGP/KeyringParser.hs
+++ b/Codec/Encryption/OpenPGP/KeyringParser.hs
@@ -32,7 +32,6 @@
 
 import Control.Applicative ((<|>), many)
 import Data.Maybe (catMaybes)
-import Data.Monoid ((<>))
 
 import Data.Text (Text)
 
diff --git a/Codec/Encryption/OpenPGP/Types/Internal/Base.hs b/Codec/Encryption/OpenPGP/Types/Internal/Base.hs
--- a/Codec/Encryption/OpenPGP/Types/Internal/Base.hs
+++ b/Codec/Encryption/OpenPGP/Types/Internal/Base.hs
@@ -2,6 +2,7 @@
 -- Copyright © 2012-2018  Clint Adams
 -- This software is released under the terms of the Expat license.
 -- (See the LICENSE file).
+{-# LANGUAGE CPP #-}
 {-# LANGUAGE DataKinds #-}
 {-# LANGUAGE DeriveDataTypeable #-}
 {-# LANGUAGE DeriveGeneric #-}
@@ -36,9 +37,7 @@
 import qualified Data.List.NonEmpty as NE
 import Data.List.Split (chunksOf)
 import Data.Maybe (fromMaybe)
-import Data.Monoid ((<>))
 import Data.Ord (comparing)
-import Data.Semigroup (Semigroup)
 import Data.Set (Set)
 import qualified Data.Set as Set
 import Data.Text (Text)
@@ -673,8 +672,10 @@
 
 instance Hashable FeatureFlag
 
+#if !MIN_VERSION_hashable(1,3,4)
 instance Hashable a => Hashable (Set a) where
   hashWithSalt salt = hashWithSalt salt . Set.toList
+#endif
 
 instance Pretty FeatureFlag where
   pretty ModificationDetection = pretty "modification-detection"
@@ -1005,7 +1006,8 @@
 
 instance Hashable SigSubPacket
 
-$(ATH.deriveJSON ATH.defaultOptions ''SigSubPacket)
+instance A.ToJSON SigSubPacket
+instance A.FromJSON SigSubPacket
 
 $(makeLenses ''SigSubPacket)
 
diff --git a/Codec/Encryption/OpenPGP/Types/Internal/PKITypes.hs b/Codec/Encryption/OpenPGP/Types/Internal/PKITypes.hs
--- a/Codec/Encryption/OpenPGP/Types/Internal/PKITypes.hs
+++ b/Codec/Encryption/OpenPGP/Types/Internal/PKITypes.hs
@@ -22,7 +22,6 @@
 import qualified Data.ByteString.Lazy as BL
 import Data.Data (Data)
 import Data.Hashable (Hashable(..))
-import Data.Monoid ((<>))
 import Data.Ord (comparing)
 import Data.Text.Prettyprint.Doc (Pretty(..), (<+>))
 import Data.Typeable (Typeable)
diff --git a/Codec/Encryption/OpenPGP/Types/Internal/Pkt.hs b/Codec/Encryption/OpenPGP/Types/Internal/Pkt.hs
--- a/Codec/Encryption/OpenPGP/Types/Internal/Pkt.hs
+++ b/Codec/Encryption/OpenPGP/Types/Internal/Pkt.hs
@@ -27,7 +27,6 @@
 import Data.Hashable (Hashable(..))
 import Data.List.NonEmpty (NonEmpty)
 import qualified Data.List.NonEmpty as NE
-import Data.Monoid ((<>))
 import Data.Ord (comparing)
 import Data.Text (Text)
 import qualified Data.Text as T
diff --git a/hOpenPGP.cabal b/hOpenPGP.cabal
--- a/hOpenPGP.cabal
+++ b/hOpenPGP.cabal
@@ -1,5 +1,6 @@
+Cabal-version:       2.2
 Name:                hOpenPGP
-Version:             2.9.5
+Version:             2.9.6
 Synopsis:            native Haskell implementation of OpenPGP (RFC4880)
 Description:         native Haskell implementation of OpenPGP (RFC4880), plus Camellia (RFC5581), plus ECC (RFC6637)
 Homepage:            https://salsa.debian.org/clint/hOpenPGP
@@ -7,7 +8,7 @@
 License-file:        LICENSE
 Author:              Clint Adams
 Maintainer:          Clint Adams <clint@debian.org>
-Copyright:           2012-2020  Clint Adams
+Copyright:           2012-2021  Clint Adams
 Category:            Codec, Data
 Build-type:          Simple
 Extra-source-files: tests/suite.hs
@@ -155,56 +156,17 @@
   , tests/data/ed25519.secretkey
   , tests/data/encryption-sym-pgcrypto.pgp
   , tests/data/pgcrypto-passphrase.txt
-Cabal-version:       >= 1.10
 
-flag network-uri
-   description: Get Network.URI from the network-uri package
-   default: True
-
-Library
-  Exposed-modules:     Codec.Encryption.OpenPGP.Types
-                     , Codec.Encryption.OpenPGP.CFB
-                     , Codec.Encryption.OpenPGP.Compression
-                     , Codec.Encryption.OpenPGP.Expirations
-                     , Codec.Encryption.OpenPGP.Fingerprint
-                     , Codec.Encryption.OpenPGP.KeyInfo
-                     , Codec.Encryption.OpenPGP.KeyringParser
-                     , Codec.Encryption.OpenPGP.KeySelection
-                     , Codec.Encryption.OpenPGP.Ontology
-                     , Codec.Encryption.OpenPGP.S2K
-                     , Codec.Encryption.OpenPGP.SecretKey
-                     , Codec.Encryption.OpenPGP.Serialize
-                     , Codec.Encryption.OpenPGP.Signatures
-                     , Codec.Encryption.OpenPGP.SignatureQualities
-                     , Data.Conduit.OpenPGP.Compression
-                     , Data.Conduit.OpenPGP.Decrypt
-                     , Data.Conduit.OpenPGP.Filter
-                     , Data.Conduit.OpenPGP.Keyring
-                     , Data.Conduit.OpenPGP.Keyring.Instances
-                     , Data.Conduit.OpenPGP.Verify
-  Other-Modules: Codec.Encryption.OpenPGP.Internal
-               , Codec.Encryption.OpenPGP.Internal.CryptoCipherTypes
-               , Codec.Encryption.OpenPGP.Internal.Cryptonite
-               , Codec.Encryption.OpenPGP.Internal.HOBlockCipher
-               , Codec.Encryption.OpenPGP.SerializeForSigs
-               , Codec.Encryption.OpenPGP.Types.Internal.Base
-               , Codec.Encryption.OpenPGP.Types.Internal.CryptoniteNewtypes
-               , Codec.Encryption.OpenPGP.Types.Internal.PacketClass
-               , Codec.Encryption.OpenPGP.Types.Internal.PKITypes
-               , Codec.Encryption.OpenPGP.Types.Internal.Pkt
-               , Codec.Encryption.OpenPGP.Types.Internal.PrettyUtils
-               , Codec.Encryption.OpenPGP.Types.Internal.TK
-               , Codec.Encryption.OpenPGP.BlockCipher
-  Build-depends: aeson
-               , asn1-encoding
+common deps
+  build-depends: aeson                               < 2
                , attoparsec
-               , base                  > 4.8     && < 5
+               , base                   > 4.9     && < 5
                , base16-bytestring
                , bifunctors
                , bytestring
-               , bz2
                , binary                >= 0.6.4.0
                , binary-conduit        >= 1.3
+               , bz2
                , conduit               >= 1.3.0
                , conduit-extra         >= 1.1
                , containers
@@ -218,7 +180,7 @@
                , memory
                , monad-loops
                , nettle
-               , openpgp-asciiarmor    >= 0.1
+               , network-uri           >= 2.6
                , prettyprinter
                , resourcet             > 0.4
                , split
@@ -229,111 +191,91 @@
                , unliftio-core
                , unordered-containers
                , zlib
-  if impl(ghc < 8.0)
-    build-depends: semigroups
-  if flag(network-uri)
-    build-depends: network-uri >= 2.6
-  else
-    build-depends: network-uri < 2.6, network < 2.6
-  default-language: Haskell2010
 
+common publicmods
+  other-modules:       Codec.Encryption.OpenPGP.Types
+                     , Codec.Encryption.OpenPGP.CFB
+                     , Codec.Encryption.OpenPGP.Compression
+                     , Codec.Encryption.OpenPGP.Expirations
+                     , Codec.Encryption.OpenPGP.Fingerprint
+                     , Codec.Encryption.OpenPGP.KeyInfo
+                     , Codec.Encryption.OpenPGP.KeyringParser
+                     , Codec.Encryption.OpenPGP.KeySelection
+                     , Codec.Encryption.OpenPGP.Ontology
+                     , Codec.Encryption.OpenPGP.S2K
+                     , Codec.Encryption.OpenPGP.SecretKey
+                     , Codec.Encryption.OpenPGP.Serialize
+                     , Codec.Encryption.OpenPGP.Signatures
+                     , Codec.Encryption.OpenPGP.SignatureQualities
+                     , Data.Conduit.OpenPGP.Compression
+                     , Data.Conduit.OpenPGP.Decrypt
+                     , Data.Conduit.OpenPGP.Filter
+                     , Data.Conduit.OpenPGP.Keyring
+                     , Data.Conduit.OpenPGP.Keyring.Instances
+                     , Data.Conduit.OpenPGP.Verify
 
+common internalmods
+  other-modules:       Codec.Encryption.OpenPGP.Internal
+                     , Codec.Encryption.OpenPGP.Internal.CryptoCipherTypes
+                     , Codec.Encryption.OpenPGP.Internal.Cryptonite
+                     , Codec.Encryption.OpenPGP.Internal.HOBlockCipher
+                     , Codec.Encryption.OpenPGP.Types.Internal.Base
+                     , Codec.Encryption.OpenPGP.Types.Internal.CryptoniteNewtypes
+                     , Codec.Encryption.OpenPGP.Types.Internal.PKITypes
+                     , Codec.Encryption.OpenPGP.Types.Internal.PacketClass
+                     , Codec.Encryption.OpenPGP.Types.Internal.Pkt
+                     , Codec.Encryption.OpenPGP.Types.Internal.PrettyUtils
+                     , Codec.Encryption.OpenPGP.Types.Internal.TK
+                     , Codec.Encryption.OpenPGP.BlockCipher
+                     , Codec.Encryption.OpenPGP.SerializeForSigs
+
+Library
+  import: deps, internalmods
+  Exposed-modules:     Codec.Encryption.OpenPGP.Types
+                     , Codec.Encryption.OpenPGP.CFB
+                     , Codec.Encryption.OpenPGP.Compression
+                     , Codec.Encryption.OpenPGP.Expirations
+                     , Codec.Encryption.OpenPGP.Fingerprint
+                     , Codec.Encryption.OpenPGP.KeyInfo
+                     , Codec.Encryption.OpenPGP.KeyringParser
+                     , Codec.Encryption.OpenPGP.KeySelection
+                     , Codec.Encryption.OpenPGP.Ontology
+                     , Codec.Encryption.OpenPGP.S2K
+                     , Codec.Encryption.OpenPGP.SecretKey
+                     , Codec.Encryption.OpenPGP.Serialize
+                     , Codec.Encryption.OpenPGP.Signatures
+                     , Codec.Encryption.OpenPGP.SignatureQualities
+                     , Data.Conduit.OpenPGP.Compression
+                     , Data.Conduit.OpenPGP.Decrypt
+                     , Data.Conduit.OpenPGP.Filter
+                     , Data.Conduit.OpenPGP.Keyring
+                     , Data.Conduit.OpenPGP.Keyring.Instances
+                     , Data.Conduit.OpenPGP.Verify
+  Build-depends: asn1-encoding
+               , openpgp-asciiarmor    >= 0.1
+  default-language: Haskell2010
+
 Test-Suite tests
+  import:     deps, publicmods, internalmods
   type:       exitcode-stdio-1.0
   main-is:    tests/suite.hs
   other-modules: Codec.Encryption.OpenPGP.Arbitrary
   Ghc-options: -Wall -with-rtsopts=-K1K
   Build-depends: hOpenPGP
-               , aeson
-               , asn1-encoding
-               , attoparsec
-               , base                  > 4.8     && < 5
-               , base16-bytestring
-               , bifunctors
-               , bytestring
-               , bz2
-               , binary                >= 0.6.4.0
-               , binary-conduit        >= 1.3
-               , conduit               >= 1.3
-               , conduit-extra
-               , containers
-               , cryptonite            >= 0.11
-               , crypto-cipher-types
-               , errors
-               , hashable
-               , incremental-parser
-               , ixset-typed
-               , lens                  >= 3.0
-               , memory
-               , monad-loops
-               , nettle
-               , prettyprinter
-               , split
-               , text
-               , time                  >= 1.1
-               , time-locale-compat
-               , transformers
-               , unliftio-core
-               , unordered-containers
-               , zlib
                , tasty
                , tasty-hunit
                , tasty-quickcheck
                , QuickCheck            > 2.9
                , quickcheck-instances
-               , resourcet             > 0.4
-  if impl(ghc < 8.0)
-    build-depends: semigroups
-  if flag(network-uri)
-    build-depends: network-uri >= 2.6, network >= 2.6
-  else
-    build-depends: network-uri < 2.6, network < 2.6
   default-language: Haskell2010
 
 Benchmark benchmark
+  import:     deps, publicmods, internalmods
   type:       exitcode-stdio-1.0
   main-is:    bench/mark.hs
   Ghc-options: -Wall
   Build-depends: hOpenPGP
-               , aeson
-               , base                  > 4.8     && < 5
-               , base16-bytestring
-               , bifunctors
-               , bytestring
-               , bz2
-               , binary                >= 0.6.4.0
-               , binary-conduit        >= 1.3
-               , conduit               >= 1.3
-               , conduit-extra         >= 1.1
-               , containers
-               , cryptonite            >= 0.11
-               , crypto-cipher-types
-               , errors
-               , hashable
-               , incremental-parser
-               , ixset-typed
-               , lens                  >= 3.0
-               , memory
-               , monad-loops
-               , nettle
-               , openpgp-asciiarmor    >= 0.1
-               , prettyprinter
-               , resourcet             > 0.4
-               , split
-               , text
-               , time                  >= 1.1
-               , time-locale-compat
-               , transformers
-               , unliftio-core
-               , unordered-containers
-               , zlib
                , criterion             > 0.8
-  if impl(ghc < 8.0)
-    build-depends: semigroups
-  if flag(network-uri)
-    build-depends: network-uri >= 2.6, network >= 2.6
-  else
-    build-depends: network-uri < 2.6, network < 2.6
   default-language: Haskell2010
 
 source-repository head
@@ -343,4 +285,4 @@
 source-repository this
   type:     git
   location: https://salsa.debian.org/clint/hOpenPGP.git
-  tag:      v2.9.5
+  tag:      v2.9.6
