    -- PKITypes.hs: OpenPGP (RFC4880) data types for public/secret keys
    -- Copyright © 2012-2022  Clint Adams
    -- This software is released under the terms of the Expat license.
    -- (See the LICENSE file).
    {-# LANGUAGE DataKinds #-}
    {-# LANGUAGE DeriveDataTypeable #-}
    {-# LANGUAGE DeriveGeneric #-}
    {-# LANGUAGE GeneralizedNewtypeDeriving #-}
    {-# LANGUAGE TemplateHaskell #-}

    module Codec.Encryption.OpenPGP.Types.Internal.PKITypes where

    import GHC.Generics (Generic)

    import Codec.Encryption.OpenPGP.Types.Internal.Base
    import Codec.Encryption.OpenPGP.Types.Internal.CryptoniteNewtypes

    import qualified Data.Aeson as A
    import qualified Data.Aeson.TH as ATH
    import qualified Data.ByteString as B
    import Data.ByteString.Lazy (ByteString)
    import qualified Data.ByteString.Lazy as BL
    import Data.Data (Data)
    import Data.Hashable (Hashable(..))
    import Data.Ord (comparing)
    import Data.Typeable (Typeable)
    import Data.Word (Word16)
    import Prettyprinter (Pretty(..), (<+>))

    data EdSigningCurve =
      Ed25519
      deriving (Typeable EdSigningCurve
    Typeable EdSigningCurve
    -> (forall (c :: * -> *).
        (forall d b. Data d => c (d -> b) -> d -> c b)
        -> (forall g. g -> c g) -> EdSigningCurve -> c EdSigningCurve)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c EdSigningCurve)
    -> (EdSigningCurve -> Constr)
    -> (EdSigningCurve -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c EdSigningCurve))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e))
        -> Maybe (c EdSigningCurve))
    -> ((forall b. Data b => b -> b)
        -> EdSigningCurve -> EdSigningCurve)
    -> (forall r r'.
        (r -> r' -> r)
        -> r -> (forall d. Data d => d -> r') -> EdSigningCurve -> r)
    -> (forall r r'.
        (r' -> r -> r)
        -> r -> (forall d. Data d => d -> r') -> EdSigningCurve -> r)
    -> (forall u.
        (forall d. Data d => d -> u) -> EdSigningCurve -> [u])
    -> (forall u.
        Int -> (forall d. Data d => d -> u) -> EdSigningCurve -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d)
        -> EdSigningCurve -> m EdSigningCurve)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d)
        -> EdSigningCurve -> m EdSigningCurve)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d)
        -> EdSigningCurve -> m EdSigningCurve)
    -> Data EdSigningCurve
    EdSigningCurve -> Constr
    EdSigningCurve -> DataType
    (forall b. Data b => b -> b) -> EdSigningCurve -> EdSigningCurve
    forall a.
    Typeable a
    -> (forall (c :: * -> *).
        (forall d b. Data d => c (d -> b) -> d -> c b)
        -> (forall g. g -> c g) -> a -> c a)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c a)
    -> (a -> Constr)
    -> (a -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c a))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
    -> ((forall b. Data b => b -> b) -> a -> a)
    -> (forall r r'.
        (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall r r'.
        (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall u. (forall d. Data d => d -> u) -> a -> [u])
    -> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> Data a
    forall u.
    Int -> (forall d. Data d => d -> u) -> EdSigningCurve -> u
    forall u. (forall d. Data d => d -> u) -> EdSigningCurve -> [u]
    forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> EdSigningCurve -> r
    forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> EdSigningCurve -> r
    forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> EdSigningCurve -> m EdSigningCurve
    forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> EdSigningCurve -> m EdSigningCurve
    forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c EdSigningCurve
    forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> EdSigningCurve -> c EdSigningCurve
    forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c EdSigningCurve)
    forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c EdSigningCurve)
    $cgfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> EdSigningCurve -> c EdSigningCurve
    gfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> EdSigningCurve -> c EdSigningCurve
    $cgunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c EdSigningCurve
    gunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c EdSigningCurve
    $ctoConstr :: EdSigningCurve -> Constr
    toConstr :: EdSigningCurve -> Constr
    $cdataTypeOf :: EdSigningCurve -> DataType
    dataTypeOf :: EdSigningCurve -> DataType
    $cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c EdSigningCurve)
    dataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c EdSigningCurve)
    $cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c EdSigningCurve)
    dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c EdSigningCurve)
    $cgmapT :: (forall b. Data b => b -> b) -> EdSigningCurve -> EdSigningCurve
    gmapT :: (forall b. Data b => b -> b) -> EdSigningCurve -> EdSigningCurve
    $cgmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> EdSigningCurve -> r
    gmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> EdSigningCurve -> r
    $cgmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> EdSigningCurve -> r
    gmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> EdSigningCurve -> r
    $cgmapQ :: forall u. (forall d. Data d => d -> u) -> EdSigningCurve -> [u]
    gmapQ :: forall u. (forall d. Data d => d -> u) -> EdSigningCurve -> [u]
    $cgmapQi :: forall u.
    Int -> (forall d. Data d => d -> u) -> EdSigningCurve -> u
    gmapQi :: forall u.
    Int -> (forall d. Data d => d -> u) -> EdSigningCurve -> u
    $cgmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> EdSigningCurve -> m EdSigningCurve
    gmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> EdSigningCurve -> m EdSigningCurve
    $cgmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> EdSigningCurve -> m EdSigningCurve
    gmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> EdSigningCurve -> m EdSigningCurve
    $cgmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> EdSigningCurve -> m EdSigningCurve
    gmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> EdSigningCurve -> m EdSigningCurve
    Data, EdSigningCurve -> EdSigningCurve -> Bool
    (EdSigningCurve -> EdSigningCurve -> Bool)
    -> (EdSigningCurve -> EdSigningCurve -> Bool) -> Eq EdSigningCurve
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: EdSigningCurve -> EdSigningCurve -> Bool
    == :: EdSigningCurve -> EdSigningCurve -> Bool
    $c/= :: EdSigningCurve -> EdSigningCurve -> Bool
    /= :: EdSigningCurve -> EdSigningCurve -> Bool
    Eq, (forall x. EdSigningCurve -> Rep EdSigningCurve x)
    -> (forall x. Rep EdSigningCurve x -> EdSigningCurve)
    -> Generic EdSigningCurve
    forall x. Rep EdSigningCurve x -> EdSigningCurve
    forall x. EdSigningCurve -> Rep EdSigningCurve x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    $cfrom :: forall x. EdSigningCurve -> Rep EdSigningCurve x
    from :: forall x. EdSigningCurve -> Rep EdSigningCurve x
    $cto :: forall x. Rep EdSigningCurve x -> EdSigningCurve
    to :: forall x. Rep EdSigningCurve x -> EdSigningCurve
    Generic, Eq EdSigningCurve
    Eq EdSigningCurve
    -> (EdSigningCurve -> EdSigningCurve -> Ordering)
    -> (EdSigningCurve -> EdSigningCurve -> Bool)
    -> (EdSigningCurve -> EdSigningCurve -> Bool)
    -> (EdSigningCurve -> EdSigningCurve -> Bool)
    -> (EdSigningCurve -> EdSigningCurve -> Bool)
    -> (EdSigningCurve -> EdSigningCurve -> EdSigningCurve)
    -> (EdSigningCurve -> EdSigningCurve -> EdSigningCurve)
    -> Ord EdSigningCurve
    EdSigningCurve -> EdSigningCurve -> Bool
    EdSigningCurve -> EdSigningCurve -> Ordering
    EdSigningCurve -> EdSigningCurve -> EdSigningCurve
    forall a.
    Eq a
    -> (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: EdSigningCurve -> EdSigningCurve -> Ordering
    compare :: EdSigningCurve -> EdSigningCurve -> Ordering
    $c< :: EdSigningCurve -> EdSigningCurve -> Bool
    < :: EdSigningCurve -> EdSigningCurve -> Bool
    $c<= :: EdSigningCurve -> EdSigningCurve -> Bool
    <= :: EdSigningCurve -> EdSigningCurve -> Bool
    $c> :: EdSigningCurve -> EdSigningCurve -> Bool
    > :: EdSigningCurve -> EdSigningCurve -> Bool
    $c>= :: EdSigningCurve -> EdSigningCurve -> Bool
    >= :: EdSigningCurve -> EdSigningCurve -> Bool
    $cmax :: EdSigningCurve -> EdSigningCurve -> EdSigningCurve
    max :: EdSigningCurve -> EdSigningCurve -> EdSigningCurve
    $cmin :: EdSigningCurve -> EdSigningCurve -> EdSigningCurve
    min :: EdSigningCurve -> EdSigningCurve -> EdSigningCurve
    Ord, Int -> EdSigningCurve -> ShowS
    [EdSigningCurve] -> ShowS
    EdSigningCurve -> String
    (Int -> EdSigningCurve -> ShowS)
    -> (EdSigningCurve -> String)
    -> ([EdSigningCurve] -> ShowS)
    -> Show EdSigningCurve
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> EdSigningCurve -> ShowS
    showsPrec :: Int -> EdSigningCurve -> ShowS
    $cshow :: EdSigningCurve -> String
    show :: EdSigningCurve -> String
    $cshowList :: [EdSigningCurve] -> ShowS
    showList :: [EdSigningCurve] -> ShowS
    Show, Typeable)

    instance Hashable EdSigningCurve

    instance Pretty EdSigningCurve where
      pretty :: forall ann. EdSigningCurve -> Doc ann
    pretty EdSigningCurve
    Ed25519 = String -> Doc ann
    forall ann. String -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    pretty String
    "Ed25519"

    instance A.FromJSON EdSigningCurve

    instance A.ToJSON EdSigningCurve

    newtype EPoint =
      EPoint
        { EPoint -> Integer
    unEPoint :: Integer
        }
      deriving (Typeable EPoint
    Typeable EPoint
    -> (forall (c :: * -> *).
        (forall d b. Data d => c (d -> b) -> d -> c b)
        -> (forall g. g -> c g) -> EPoint -> c EPoint)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c EPoint)
    -> (EPoint -> Constr)
    -> (EPoint -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c EPoint))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c EPoint))
    -> ((forall b. Data b => b -> b) -> EPoint -> EPoint)
    -> (forall r r'.
        (r -> r' -> r)
        -> r -> (forall d. Data d => d -> r') -> EPoint -> r)
    -> (forall r r'.
        (r' -> r -> r)
        -> r -> (forall d. Data d => d -> r') -> EPoint -> r)
    -> (forall u. (forall d. Data d => d -> u) -> EPoint -> [u])
    -> (forall u. Int -> (forall d. Data d => d -> u) -> EPoint -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d) -> EPoint -> m EPoint)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> EPoint -> m EPoint)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> EPoint -> m EPoint)
    -> Data EPoint
    EPoint -> Constr
    EPoint -> DataType
    (forall b. Data b => b -> b) -> EPoint -> EPoint
    forall a.
    Typeable a
    -> (forall (c :: * -> *).
        (forall d b. Data d => c (d -> b) -> d -> c b)
        -> (forall g. g -> c g) -> a -> c a)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c a)
    -> (a -> Constr)
    -> (a -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c a))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
    -> ((forall b. Data b => b -> b) -> a -> a)
    -> (forall r r'.
        (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall r r'.
        (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall u. (forall d. Data d => d -> u) -> a -> [u])
    -> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> Data a
    forall u. Int -> (forall d. Data d => d -> u) -> EPoint -> u
    forall u. (forall d. Data d => d -> u) -> EPoint -> [u]
    forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> EPoint -> r
    forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> EPoint -> r
    forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> EPoint -> m EPoint
    forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> EPoint -> m EPoint
    forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c EPoint
    forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> EPoint -> c EPoint
    forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c EPoint)
    forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c EPoint)
    $cgfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> EPoint -> c EPoint
    gfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> EPoint -> c EPoint
    $cgunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c EPoint
    gunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c EPoint
    $ctoConstr :: EPoint -> Constr
    toConstr :: EPoint -> Constr
    $cdataTypeOf :: EPoint -> DataType
    dataTypeOf :: EPoint -> DataType
    $cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c EPoint)
    dataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c EPoint)
    $cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c EPoint)
    dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c EPoint)
    $cgmapT :: (forall b. Data b => b -> b) -> EPoint -> EPoint
    gmapT :: (forall b. Data b => b -> b) -> EPoint -> EPoint
    $cgmapQl :: forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> EPoint -> r
    gmapQl :: forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> EPoint -> r
    $cgmapQr :: forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> EPoint -> r
    gmapQr :: forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> EPoint -> r
    $cgmapQ :: forall u. (forall d. Data d => d -> u) -> EPoint -> [u]
    gmapQ :: forall u. (forall d. Data d => d -> u) -> EPoint -> [u]
    $cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> EPoint -> u
    gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> EPoint -> u
    $cgmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> EPoint -> m EPoint
    gmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> EPoint -> m EPoint
    $cgmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> EPoint -> m EPoint
    gmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> EPoint -> m EPoint
    $cgmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> EPoint -> m EPoint
    gmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> EPoint -> m EPoint
    Data, EPoint -> EPoint -> Bool
    (EPoint -> EPoint -> Bool)
    -> (EPoint -> EPoint -> Bool) -> Eq EPoint
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: EPoint -> EPoint -> Bool
    == :: EPoint -> EPoint -> Bool
    $c/= :: EPoint -> EPoint -> Bool
    /= :: EPoint -> EPoint -> Bool
    Eq, (forall x. EPoint -> Rep EPoint x)
    -> (forall x. Rep EPoint x -> EPoint) -> Generic EPoint
    forall x. Rep EPoint x -> EPoint
    forall x. EPoint -> Rep EPoint x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    $cfrom :: forall x. EPoint -> Rep EPoint x
    from :: forall x. EPoint -> Rep EPoint x
    $cto :: forall x. Rep EPoint x -> EPoint
    to :: forall x. Rep EPoint x -> EPoint
    Generic, Eq EPoint
    Eq EPoint
    -> (EPoint -> EPoint -> Ordering)
    -> (EPoint -> EPoint -> Bool)
    -> (EPoint -> EPoint -> Bool)
    -> (EPoint -> EPoint -> Bool)
    -> (EPoint -> EPoint -> Bool)
    -> (EPoint -> EPoint -> EPoint)
    -> (EPoint -> EPoint -> EPoint)
    -> Ord EPoint
    EPoint -> EPoint -> Bool
    EPoint -> EPoint -> Ordering
    EPoint -> EPoint -> EPoint
    forall a.
    Eq a
    -> (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: EPoint -> EPoint -> Ordering
    compare :: EPoint -> EPoint -> Ordering
    $c< :: EPoint -> EPoint -> Bool
    < :: EPoint -> EPoint -> Bool
    $c<= :: EPoint -> EPoint -> Bool
    <= :: EPoint -> EPoint -> Bool
    $c> :: EPoint -> EPoint -> Bool
    > :: EPoint -> EPoint -> Bool
    $c>= :: EPoint -> EPoint -> Bool
    >= :: EPoint -> EPoint -> Bool
    $cmax :: EPoint -> EPoint -> EPoint
    max :: EPoint -> EPoint -> EPoint
    $cmin :: EPoint -> EPoint -> EPoint
    min :: EPoint -> EPoint -> EPoint
    Ord, (forall ann. EPoint -> Doc ann)
    -> (forall ann. [EPoint] -> Doc ann) -> Pretty EPoint
    forall ann. [EPoint] -> Doc ann
    forall ann. EPoint -> Doc ann
    forall a.
    (forall ann. a -> Doc ann)
    -> (forall ann. [a] -> Doc ann) -> Pretty a
    $cpretty :: forall ann. EPoint -> Doc ann
    pretty :: forall ann. EPoint -> Doc ann
    $cprettyList :: forall ann. [EPoint] -> Doc ann
    prettyList :: forall ann. [EPoint] -> Doc ann
    Pretty, Int -> EPoint -> ShowS
    [EPoint] -> ShowS
    EPoint -> String
    (Int -> EPoint -> ShowS)
    -> (EPoint -> String) -> ([EPoint] -> ShowS) -> Show EPoint
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> EPoint -> ShowS
    showsPrec :: Int -> EPoint -> ShowS
    $cshow :: EPoint -> String
    show :: EPoint -> String
    $cshowList :: [EPoint] -> ShowS
    showList :: [EPoint] -> ShowS
    Show, Typeable)

    instance Hashable EPoint

    instance A.FromJSON EPoint

    instance A.ToJSON EPoint

    data PKey
      = RSAPubKey RSA_PublicKey
      | DSAPubKey DSA_PublicKey
      | ElGamalPubKey Integer Integer Integer
      | ECDHPubKey PKey HashAlgorithm SymmetricAlgorithm
      | ECDSAPubKey ECDSA_PublicKey
      | EdDSAPubKey EdSigningCurve EPoint
      | UnknownPKey ByteString
      deriving (Typeable PKey
    Typeable PKey
    -> (forall (c :: * -> *).
        (forall d b. Data d => c (d -> b) -> d -> c b)
        -> (forall g. g -> c g) -> PKey -> c PKey)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c PKey)
    -> (PKey -> Constr)
    -> (PKey -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c PKey))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c PKey))
    -> ((forall b. Data b => b -> b) -> PKey -> PKey)
    -> (forall r r'.
        (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> PKey -> r)
    -> (forall r r'.
        (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> PKey -> r)
    -> (forall u. (forall d. Data d => d -> u) -> PKey -> [u])
    -> (forall u. Int -> (forall d. Data d => d -> u) -> PKey -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d) -> PKey -> m PKey)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> PKey -> m PKey)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> PKey -> m PKey)
    -> Data PKey
    PKey -> Constr
    PKey -> DataType
    (forall b. Data b => b -> b) -> PKey -> PKey
    forall a.
    Typeable a
    -> (forall (c :: * -> *).
        (forall d b. Data d => c (d -> b) -> d -> c b)
        -> (forall g. g -> c g) -> a -> c a)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c a)
    -> (a -> Constr)
    -> (a -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c a))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
    -> ((forall b. Data b => b -> b) -> a -> a)
    -> (forall r r'.
        (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall r r'.
        (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall u. (forall d. Data d => d -> u) -> a -> [u])
    -> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> Data a
    forall u. Int -> (forall d. Data d => d -> u) -> PKey -> u
    forall u. (forall d. Data d => d -> u) -> PKey -> [u]
    forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> PKey -> r
    forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> PKey -> r
    forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> PKey -> m PKey
    forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> PKey -> m PKey
    forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c PKey
    forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> PKey -> c PKey
    forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c PKey)
    forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c PKey)
    $cgfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> PKey -> c PKey
    gfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> PKey -> c PKey
    $cgunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c PKey
    gunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c PKey
    $ctoConstr :: PKey -> Constr
    toConstr :: PKey -> Constr
    $cdataTypeOf :: PKey -> DataType
    dataTypeOf :: PKey -> DataType
    $cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c PKey)
    dataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c PKey)
    $cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c PKey)
    dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c PKey)
    $cgmapT :: (forall b. Data b => b -> b) -> PKey -> PKey
    gmapT :: (forall b. Data b => b -> b) -> PKey -> PKey
    $cgmapQl :: forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> PKey -> r
    gmapQl :: forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> PKey -> r
    $cgmapQr :: forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> PKey -> r
    gmapQr :: forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> PKey -> r
    $cgmapQ :: forall u. (forall d. Data d => d -> u) -> PKey -> [u]
    gmapQ :: forall u. (forall d. Data d => d -> u) -> PKey -> [u]
    $cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> PKey -> u
    gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> PKey -> u
    $cgmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> PKey -> m PKey
    gmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> PKey -> m PKey
    $cgmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> PKey -> m PKey
    gmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> PKey -> m PKey
    $cgmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> PKey -> m PKey
    gmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> PKey -> m PKey
    Data, PKey -> PKey -> Bool
    (PKey -> PKey -> Bool) -> (PKey -> PKey -> Bool) -> Eq PKey
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: PKey -> PKey -> Bool
    == :: PKey -> PKey -> Bool
    $c/= :: PKey -> PKey -> Bool
    /= :: PKey -> PKey -> Bool
    Eq, (forall x. PKey -> Rep PKey x)
    -> (forall x. Rep PKey x -> PKey) -> Generic PKey
    forall x. Rep PKey x -> PKey
    forall x. PKey -> Rep PKey x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    $cfrom :: forall x. PKey -> Rep PKey x
    from :: forall x. PKey -> Rep PKey x
    $cto :: forall x. Rep PKey x -> PKey
    to :: forall x. Rep PKey x -> PKey
    Generic, Eq PKey
    Eq PKey
    -> (PKey -> PKey -> Ordering)
    -> (PKey -> PKey -> Bool)
    -> (PKey -> PKey -> Bool)
    -> (PKey -> PKey -> Bool)
    -> (PKey -> PKey -> Bool)
    -> (PKey -> PKey -> PKey)
    -> (PKey -> PKey -> PKey)
    -> Ord PKey
    PKey -> PKey -> Bool
    PKey -> PKey -> Ordering
    PKey -> PKey -> PKey
    forall a.
    Eq a
    -> (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: PKey -> PKey -> Ordering
    compare :: PKey -> PKey -> Ordering
    $c< :: PKey -> PKey -> Bool
    < :: PKey -> PKey -> Bool
    $c<= :: PKey -> PKey -> Bool
    <= :: PKey -> PKey -> Bool
    $c> :: PKey -> PKey -> Bool
    > :: PKey -> PKey -> Bool
    $c>= :: PKey -> PKey -> Bool
    >= :: PKey -> PKey -> Bool
    $cmax :: PKey -> PKey -> PKey
    max :: PKey -> PKey -> PKey
    $cmin :: PKey -> PKey -> PKey
    min :: PKey -> PKey -> PKey
    Ord, Int -> PKey -> ShowS
    [PKey] -> ShowS
    PKey -> String
    (Int -> PKey -> ShowS)
    -> (PKey -> String) -> ([PKey] -> ShowS) -> Show PKey
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> PKey -> ShowS
    showsPrec :: Int -> PKey -> ShowS
    $cshow :: PKey -> String
    show :: PKey -> String
    $cshowList :: [PKey] -> ShowS
    showList :: [PKey] -> ShowS
    Show, Typeable)

    instance Hashable PKey

    instance Pretty PKey where
      pretty :: forall ann. PKey -> Doc ann
    pretty (RSAPubKey RSA_PublicKey
    p) = String -> Doc ann
    forall ann. String -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    pretty String
    "RSA" Doc ann -> Doc ann -> Doc ann
    forall ann. Doc ann -> Doc ann -> Doc ann
    <+> RSA_PublicKey -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    forall ann. RSA_PublicKey -> Doc ann
    pretty RSA_PublicKey
    p
      pretty (DSAPubKey DSA_PublicKey
    p) = String -> Doc ann
    forall ann. String -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    pretty String
    "DSA" Doc ann -> Doc ann -> Doc ann
    forall ann. Doc ann -> Doc ann -> Doc ann
    <+> DSA_PublicKey -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    forall ann. DSA_PublicKey -> Doc ann
    pretty DSA_PublicKey
    p
      pretty (ElGamalPubKey Integer
    p Integer
    g Integer
    y) =
        String -> Doc ann
    forall ann. String -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    pretty String
    "Elgamal" Doc ann -> Doc ann -> Doc ann
    forall ann. Doc ann -> Doc ann -> Doc ann
    <+> Integer -> Doc ann
    forall ann. Integer -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    pretty Integer
    p Doc ann -> Doc ann -> Doc ann
    forall ann. Doc ann -> Doc ann -> Doc ann
    <+> Integer -> Doc ann
    forall ann. Integer -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    pretty Integer
    g Doc ann -> Doc ann -> Doc ann
    forall ann. Doc ann -> Doc ann -> Doc ann
    <+> Integer -> Doc ann
    forall ann. Integer -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    pretty Integer
    y
      pretty (ECDHPubKey PKey
    p HashAlgorithm
    ha SymmetricAlgorithm
    sa) =
        String -> Doc ann
    forall ann. String -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    pretty String
    "ECDH" Doc ann -> Doc ann -> Doc ann
    forall ann. Doc ann -> Doc ann -> Doc ann
    <+> PKey -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    forall ann. PKey -> Doc ann
    pretty PKey
    p Doc ann -> Doc ann -> Doc ann
    forall ann. Doc ann -> Doc ann -> Doc ann
    <+> HashAlgorithm -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    forall ann. HashAlgorithm -> Doc ann
    pretty HashAlgorithm
    ha Doc ann -> Doc ann -> Doc ann
    forall ann. Doc ann -> Doc ann -> Doc ann
    <+> SymmetricAlgorithm -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    forall ann. SymmetricAlgorithm -> Doc ann
    pretty SymmetricAlgorithm
    sa
      pretty (ECDSAPubKey ECDSA_PublicKey
    p) = String -> Doc ann
    forall ann. String -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    pretty String
    "ECDSA" Doc ann -> Doc ann -> Doc ann
    forall ann. Doc ann -> Doc ann -> Doc ann
    <+> ECDSA_PublicKey -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    forall ann. ECDSA_PublicKey -> Doc ann
    pretty ECDSA_PublicKey
    p
      pretty (EdDSAPubKey EdSigningCurve
    c EPoint
    ep) = EdSigningCurve -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    forall ann. EdSigningCurve -> Doc ann
    pretty EdSigningCurve
    c Doc ann -> Doc ann -> Doc ann
    forall ann. Doc ann -> Doc ann -> Doc ann
    <+> EPoint -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    forall ann. EPoint -> Doc ann
    pretty EPoint
    ep
      pretty (UnknownPKey ByteString
    bs) = String -> Doc ann
    forall ann. String -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    pretty String
    "<unknown>" Doc ann -> Doc ann -> Doc ann
    forall ann. Doc ann -> Doc ann -> Doc ann
    <+> String -> Doc ann
    forall ann. String -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    pretty (ByteString -> String
    bsToHexUpper ByteString
    bs)

    instance A.ToJSON PKey where
      toJSON :: PKey -> Value
    toJSON (RSAPubKey RSA_PublicKey
    p) = RSA_PublicKey -> Value
    forall a. ToJSON a => a -> Value
    A.toJSON RSA_PublicKey
    p
      toJSON (DSAPubKey DSA_PublicKey
    p) = DSA_PublicKey -> Value
    forall a. ToJSON a => a -> Value
    A.toJSON DSA_PublicKey
    p
      toJSON (ElGamalPubKey Integer
    p Integer
    g Integer
    y) = (Integer, Integer, Integer) -> Value
    forall a. ToJSON a => a -> Value
    A.toJSON (Integer
    p, Integer
    g, Integer
    y)
      toJSON (ECDHPubKey PKey
    p HashAlgorithm
    ha SymmetricAlgorithm
    sa) = (PKey, HashAlgorithm, SymmetricAlgorithm) -> Value
    forall a. ToJSON a => a -> Value
    A.toJSON (PKey
    p, HashAlgorithm
    ha, SymmetricAlgorithm
    sa)
      toJSON (ECDSAPubKey ECDSA_PublicKey
    p) = ECDSA_PublicKey -> Value
    forall a. ToJSON a => a -> Value
    A.toJSON ECDSA_PublicKey
    p
      toJSON (EdDSAPubKey EdSigningCurve
    c EPoint
    ep) = (EdSigningCurve, EPoint) -> Value
    forall a. ToJSON a => a -> Value
    A.toJSON (EdSigningCurve
    c, EPoint
    ep)
      toJSON (UnknownPKey ByteString
    bs) = [Word8] -> Value
    forall a. ToJSON a => a -> Value
    A.toJSON (ByteString -> [Word8]
    BL.unpack ByteString
    bs)

    data SKey
      = RSAPrivateKey RSA_PrivateKey
      | DSAPrivateKey DSA_PrivateKey
      | ElGamalPrivateKey Integer
      | ECDHPrivateKey ECDSA_PrivateKey
      | ECDSAPrivateKey ECDSA_PrivateKey
      | EdDSAPrivateKey EdSigningCurve B.ByteString
      | UnknownSKey ByteString
      deriving (Typeable SKey
    Typeable SKey
    -> (forall (c :: * -> *).
        (forall d b. Data d => c (d -> b) -> d -> c b)
        -> (forall g. g -> c g) -> SKey -> c SKey)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c SKey)
    -> (SKey -> Constr)
    -> (SKey -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c SKey))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SKey))
    -> ((forall b. Data b => b -> b) -> SKey -> SKey)
    -> (forall r r'.
        (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SKey -> r)
    -> (forall r r'.
        (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SKey -> r)
    -> (forall u. (forall d. Data d => d -> u) -> SKey -> [u])
    -> (forall u. Int -> (forall d. Data d => d -> u) -> SKey -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d) -> SKey -> m SKey)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> SKey -> m SKey)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> SKey -> m SKey)
    -> Data SKey
    SKey -> Constr
    SKey -> DataType
    (forall b. Data b => b -> b) -> SKey -> SKey
    forall a.
    Typeable a
    -> (forall (c :: * -> *).
        (forall d b. Data d => c (d -> b) -> d -> c b)
        -> (forall g. g -> c g) -> a -> c a)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c a)
    -> (a -> Constr)
    -> (a -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c a))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
    -> ((forall b. Data b => b -> b) -> a -> a)
    -> (forall r r'.
        (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall r r'.
        (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall u. (forall d. Data d => d -> u) -> a -> [u])
    -> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> Data a
    forall u. Int -> (forall d. Data d => d -> u) -> SKey -> u
    forall u. (forall d. Data d => d -> u) -> SKey -> [u]
    forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SKey -> r
    forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SKey -> r
    forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> SKey -> m SKey
    forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> SKey -> m SKey
    forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c SKey
    forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> SKey -> c SKey
    forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c SKey)
    forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SKey)
    $cgfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> SKey -> c SKey
    gfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> SKey -> c SKey
    $cgunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c SKey
    gunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c SKey
    $ctoConstr :: SKey -> Constr
    toConstr :: SKey -> Constr
    $cdataTypeOf :: SKey -> DataType
    dataTypeOf :: SKey -> DataType
    $cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c SKey)
    dataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c SKey)
    $cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SKey)
    dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SKey)
    $cgmapT :: (forall b. Data b => b -> b) -> SKey -> SKey
    gmapT :: (forall b. Data b => b -> b) -> SKey -> SKey
    $cgmapQl :: forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SKey -> r
    gmapQl :: forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SKey -> r
    $cgmapQr :: forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SKey -> r
    gmapQr :: forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SKey -> r
    $cgmapQ :: forall u. (forall d. Data d => d -> u) -> SKey -> [u]
    gmapQ :: forall u. (forall d. Data d => d -> u) -> SKey -> [u]
    $cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> SKey -> u
    gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> SKey -> u
    $cgmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> SKey -> m SKey
    gmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> SKey -> m SKey
    $cgmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> SKey -> m SKey
    gmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> SKey -> m SKey
    $cgmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> SKey -> m SKey
    gmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> SKey -> m SKey
    Data, SKey -> SKey -> Bool
    (SKey -> SKey -> Bool) -> (SKey -> SKey -> Bool) -> Eq SKey
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: SKey -> SKey -> Bool
    == :: SKey -> SKey -> Bool
    $c/= :: SKey -> SKey -> Bool
    /= :: SKey -> SKey -> Bool
    Eq, (forall x. SKey -> Rep SKey x)
    -> (forall x. Rep SKey x -> SKey) -> Generic SKey
    forall x. Rep SKey x -> SKey
    forall x. SKey -> Rep SKey x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    $cfrom :: forall x. SKey -> Rep SKey x
    from :: forall x. SKey -> Rep SKey x
    $cto :: forall x. Rep SKey x -> SKey
    to :: forall x. Rep SKey x -> SKey
    Generic, Int -> SKey -> ShowS
    [SKey] -> ShowS
    SKey -> String
    (Int -> SKey -> ShowS)
    -> (SKey -> String) -> ([SKey] -> ShowS) -> Show SKey
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> SKey -> ShowS
    showsPrec :: Int -> SKey -> ShowS
    $cshow :: SKey -> String
    show :: SKey -> String
    $cshowList :: [SKey] -> ShowS
    showList :: [SKey] -> ShowS
    Show, Typeable)

    instance Hashable SKey

    instance Pretty SKey where
      pretty :: forall ann. SKey -> Doc ann
    pretty (RSAPrivateKey RSA_PrivateKey
    p) = String -> Doc ann
    forall ann. String -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    pretty String
    "RSA" Doc ann -> Doc ann -> Doc ann
    forall ann. Doc ann -> Doc ann -> Doc ann
    <+> RSA_PrivateKey -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    forall ann. RSA_PrivateKey -> Doc ann
    pretty RSA_PrivateKey
    p
      pretty (DSAPrivateKey DSA_PrivateKey
    p) = String -> Doc ann
    forall ann. String -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    pretty String
    "DSA" Doc ann -> Doc ann -> Doc ann
    forall ann. Doc ann -> Doc ann -> Doc ann
    <+> DSA_PrivateKey -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    forall ann. DSA_PrivateKey -> Doc ann
    pretty DSA_PrivateKey
    p
      pretty (ElGamalPrivateKey Integer
    p) = String -> Doc ann
    forall ann. String -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    pretty String
    "Elgamal" Doc ann -> Doc ann -> Doc ann
    forall ann. Doc ann -> Doc ann -> Doc ann
    <+> Integer -> Doc ann
    forall ann. Integer -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    pretty Integer
    p
      pretty (ECDHPrivateKey ECDSA_PrivateKey
    p) = String -> Doc ann
    forall ann. String -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    pretty String
    "ECDH" Doc ann -> Doc ann -> Doc ann
    forall ann. Doc ann -> Doc ann -> Doc ann
    <+> ECDSA_PrivateKey -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    forall ann. ECDSA_PrivateKey -> Doc ann
    pretty ECDSA_PrivateKey
    p
      pretty (ECDSAPrivateKey ECDSA_PrivateKey
    p) = String -> Doc ann
    forall ann. String -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    pretty String
    "ECDSA" Doc ann -> Doc ann -> Doc ann
    forall ann. Doc ann -> Doc ann -> Doc ann
    <+> ECDSA_PrivateKey -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    forall ann. ECDSA_PrivateKey -> Doc ann
    pretty ECDSA_PrivateKey
    p
      pretty (EdDSAPrivateKey EdSigningCurve
    c ByteString
    bs) =
        EdSigningCurve -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    forall ann. EdSigningCurve -> Doc ann
    pretty EdSigningCurve
    c Doc ann -> Doc ann -> Doc ann
    forall ann. Doc ann -> Doc ann -> Doc ann
    <+> String -> Doc ann
    forall ann. String -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    pretty (ByteString -> String
    bsToHexUpper (ByteString -> ByteString
    BL.fromStrict ByteString
    bs))
      pretty (UnknownSKey ByteString
    bs) = String -> Doc ann
    forall ann. String -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    pretty String
    "<unknown>" Doc ann -> Doc ann -> Doc ann
    forall ann. Doc ann -> Doc ann -> Doc ann
    <+> String -> Doc ann
    forall ann. String -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    pretty (ByteString -> String
    bsToHexUpper ByteString
    bs)

    instance A.ToJSON SKey where
      toJSON :: SKey -> Value
    toJSON (RSAPrivateKey RSA_PrivateKey
    k) = RSA_PrivateKey -> Value
    forall a. ToJSON a => a -> Value
    A.toJSON RSA_PrivateKey
    k
      toJSON (DSAPrivateKey DSA_PrivateKey
    k) = DSA_PrivateKey -> Value
    forall a. ToJSON a => a -> Value
    A.toJSON DSA_PrivateKey
    k
      toJSON (ElGamalPrivateKey Integer
    k) = Integer -> Value
    forall a. ToJSON a => a -> Value
    A.toJSON Integer
    k
      toJSON (ECDHPrivateKey ECDSA_PrivateKey
    k) = ECDSA_PrivateKey -> Value
    forall a. ToJSON a => a -> Value
    A.toJSON ECDSA_PrivateKey
    k
      toJSON (ECDSAPrivateKey ECDSA_PrivateKey
    k) = ECDSA_PrivateKey -> Value
    forall a. ToJSON a => a -> Value
    A.toJSON ECDSA_PrivateKey
    k
      toJSON (EdDSAPrivateKey EdSigningCurve
    c ByteString
    bs) = (EdSigningCurve, [Word8]) -> Value
    forall a. ToJSON a => a -> Value
    A.toJSON (EdSigningCurve
    c, ByteString -> [Word8]
    B.unpack ByteString
    bs)
      toJSON (UnknownSKey ByteString
    bs) = [Word8] -> Value
    forall a. ToJSON a => a -> Value
    A.toJSON (ByteString -> [Word8]
    BL.unpack ByteString
    bs)

    data PKPayload =
      PKPayload
        { PKPayload -> KeyVersion
    _keyVersion :: KeyVersion
        , PKPayload -> ThirtyTwoBitTimeStamp
    _timestamp :: ThirtyTwoBitTimeStamp
        , PKPayload -> V3Expiration
    _v3exp :: V3Expiration
        , PKPayload -> PubKeyAlgorithm
    _pkalgo :: PubKeyAlgorithm
        , PKPayload -> PKey
    _pubkey :: PKey
        }
      deriving (Typeable PKPayload
    Typeable PKPayload
    -> (forall (c :: * -> *).
        (forall d b. Data d => c (d -> b) -> d -> c b)
        -> (forall g. g -> c g) -> PKPayload -> c PKPayload)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c PKPayload)
    -> (PKPayload -> Constr)
    -> (PKPayload -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c PKPayload))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c PKPayload))
    -> ((forall b. Data b => b -> b) -> PKPayload -> PKPayload)
    -> (forall r r'.
        (r -> r' -> r)
        -> r -> (forall d. Data d => d -> r') -> PKPayload -> r)
    -> (forall r r'.
        (r' -> r -> r)
        -> r -> (forall d. Data d => d -> r') -> PKPayload -> r)
    -> (forall u. (forall d. Data d => d -> u) -> PKPayload -> [u])
    -> (forall u.
        Int -> (forall d. Data d => d -> u) -> PKPayload -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d) -> PKPayload -> m PKPayload)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> PKPayload -> m PKPayload)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> PKPayload -> m PKPayload)
    -> Data PKPayload
    PKPayload -> Constr
    PKPayload -> DataType
    (forall b. Data b => b -> b) -> PKPayload -> PKPayload
    forall a.
    Typeable a
    -> (forall (c :: * -> *).
        (forall d b. Data d => c (d -> b) -> d -> c b)
        -> (forall g. g -> c g) -> a -> c a)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c a)
    -> (a -> Constr)
    -> (a -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c a))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
    -> ((forall b. Data b => b -> b) -> a -> a)
    -> (forall r r'.
        (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall r r'.
        (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall u. (forall d. Data d => d -> u) -> a -> [u])
    -> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> Data a
    forall u. Int -> (forall d. Data d => d -> u) -> PKPayload -> u
    forall u. (forall d. Data d => d -> u) -> PKPayload -> [u]
    forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> PKPayload -> r
    forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> PKPayload -> r
    forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> PKPayload -> m PKPayload
    forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> PKPayload -> m PKPayload
    forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c PKPayload
    forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> PKPayload -> c PKPayload
    forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c PKPayload)
    forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c PKPayload)
    $cgfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> PKPayload -> c PKPayload
    gfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> PKPayload -> c PKPayload
    $cgunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c PKPayload
    gunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c PKPayload
    $ctoConstr :: PKPayload -> Constr
    toConstr :: PKPayload -> Constr
    $cdataTypeOf :: PKPayload -> DataType
    dataTypeOf :: PKPayload -> DataType
    $cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c PKPayload)
    dataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c PKPayload)
    $cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c PKPayload)
    dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c PKPayload)
    $cgmapT :: (forall b. Data b => b -> b) -> PKPayload -> PKPayload
    gmapT :: (forall b. Data b => b -> b) -> PKPayload -> PKPayload
    $cgmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> PKPayload -> r
    gmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> PKPayload -> r
    $cgmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> PKPayload -> r
    gmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> PKPayload -> r
    $cgmapQ :: forall u. (forall d. Data d => d -> u) -> PKPayload -> [u]
    gmapQ :: forall u. (forall d. Data d => d -> u) -> PKPayload -> [u]
    $cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> PKPayload -> u
    gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> PKPayload -> u
    $cgmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> PKPayload -> m PKPayload
    gmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> PKPayload -> m PKPayload
    $cgmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> PKPayload -> m PKPayload
    gmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> PKPayload -> m PKPayload
    $cgmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> PKPayload -> m PKPayload
    gmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> PKPayload -> m PKPayload
    Data, PKPayload -> PKPayload -> Bool
    (PKPayload -> PKPayload -> Bool)
    -> (PKPayload -> PKPayload -> Bool) -> Eq PKPayload
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: PKPayload -> PKPayload -> Bool
    == :: PKPayload -> PKPayload -> Bool
    $c/= :: PKPayload -> PKPayload -> Bool
    /= :: PKPayload -> PKPayload -> Bool
    Eq, (forall x. PKPayload -> Rep PKPayload x)
    -> (forall x. Rep PKPayload x -> PKPayload) -> Generic PKPayload
    forall x. Rep PKPayload x -> PKPayload
    forall x. PKPayload -> Rep PKPayload x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    $cfrom :: forall x. PKPayload -> Rep PKPayload x
    from :: forall x. PKPayload -> Rep PKPayload x
    $cto :: forall x. Rep PKPayload x -> PKPayload
    to :: forall x. Rep PKPayload x -> PKPayload
    Generic, Int -> PKPayload -> ShowS
    [PKPayload] -> ShowS
    PKPayload -> String
    (Int -> PKPayload -> ShowS)
    -> (PKPayload -> String)
    -> ([PKPayload] -> ShowS)
    -> Show PKPayload
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> PKPayload -> ShowS
    showsPrec :: Int -> PKPayload -> ShowS
    $cshow :: PKPayload -> String
    show :: PKPayload -> String
    $cshowList :: [PKPayload] -> ShowS
    showList :: [PKPayload] -> ShowS
    Show, Typeable)

    instance Ord PKPayload where
      compare :: PKPayload -> PKPayload -> Ordering
    compare =
        (PKPayload -> KeyVersion) -> PKPayload -> PKPayload -> Ordering
    forall a b. Ord a => (b -> a) -> b -> b -> Ordering
    comparing PKPayload -> KeyVersion
    _keyVersion (PKPayload -> PKPayload -> Ordering)
    -> (PKPayload -> PKPayload -> Ordering)
    -> PKPayload
    -> PKPayload
    -> Ordering
    forall a. Semigroup a => a -> a -> a
    <> (PKPayload -> ThirtyTwoBitTimeStamp)
    -> PKPayload -> PKPayload -> Ordering
    forall a b. Ord a => (b -> a) -> b -> b -> Ordering
    comparing PKPayload -> ThirtyTwoBitTimeStamp
    _timestamp (PKPayload -> PKPayload -> Ordering)
    -> (PKPayload -> PKPayload -> Ordering)
    -> PKPayload
    -> PKPayload
    -> Ordering
    forall a. Semigroup a => a -> a -> a
    <> (PKPayload -> V3Expiration) -> PKPayload -> PKPayload -> Ordering
    forall a b. Ord a => (b -> a) -> b -> b -> Ordering
    comparing PKPayload -> V3Expiration
    _v3exp (PKPayload -> PKPayload -> Ordering)
    -> (PKPayload -> PKPayload -> Ordering)
    -> PKPayload
    -> PKPayload
    -> Ordering
    forall a. Semigroup a => a -> a -> a
    <>
        (PKPayload -> PubKeyAlgorithm)
    -> PKPayload -> PKPayload -> Ordering
    forall a b. Ord a => (b -> a) -> b -> b -> Ordering
    comparing PKPayload -> PubKeyAlgorithm
    _pkalgo (PKPayload -> PKPayload -> Ordering)
    -> (PKPayload -> PKPayload -> Ordering)
    -> PKPayload
    -> PKPayload
    -> Ordering
    forall a. Semigroup a => a -> a -> a
    <>
        (PKPayload -> PKey) -> PKPayload -> PKPayload -> Ordering
    forall a b. Ord a => (b -> a) -> b -> b -> Ordering
    comparing PKPayload -> PKey
    _pubkey

    instance Hashable PKPayload

    instance Pretty PKPayload where
      pretty :: forall ann. PKPayload -> Doc ann
    pretty (PKPayload KeyVersion
    kv ThirtyTwoBitTimeStamp
    ts V3Expiration
    v3e PubKeyAlgorithm
    pka PKey
    p) =
        KeyVersion -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    forall ann. KeyVersion -> Doc ann
    pretty KeyVersion
    kv Doc ann -> Doc ann -> Doc ann
    forall ann. Doc ann -> Doc ann -> Doc ann
    <+> ThirtyTwoBitTimeStamp -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    forall ann. ThirtyTwoBitTimeStamp -> Doc ann
    pretty ThirtyTwoBitTimeStamp
    ts Doc ann -> Doc ann -> Doc ann
    forall ann. Doc ann -> Doc ann -> Doc ann
    <+> V3Expiration -> Doc ann
    forall ann. V3Expiration -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    pretty V3Expiration
    v3e Doc ann -> Doc ann -> Doc ann
    forall ann. Doc ann -> Doc ann -> Doc ann
    <+> PubKeyAlgorithm -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    forall ann. PubKeyAlgorithm -> Doc ann
    pretty PubKeyAlgorithm
    pka Doc ann -> Doc ann -> Doc ann
    forall ann. Doc ann -> Doc ann -> Doc ann
    <+> PKey -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    forall ann. PKey -> Doc ann
    pretty PKey
    p

    $(ATH.deriveToJSON ATH.defaultOptions ''PKPayload)

    data SKAddendum
      = SUS16bit SymmetricAlgorithm S2K IV ByteString
      | SUSSHA1 SymmetricAlgorithm S2K IV ByteString
      | SUSym SymmetricAlgorithm IV ByteString
      | SUUnencrypted SKey Word16
      deriving (Typeable SKAddendum
    Typeable SKAddendum
    -> (forall (c :: * -> *).
        (forall d b. Data d => c (d -> b) -> d -> c b)
        -> (forall g. g -> c g) -> SKAddendum -> c SKAddendum)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c SKAddendum)
    -> (SKAddendum -> Constr)
    -> (SKAddendum -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c SKAddendum))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e))
        -> Maybe (c SKAddendum))
    -> ((forall b. Data b => b -> b) -> SKAddendum -> SKAddendum)
    -> (forall r r'.
        (r -> r' -> r)
        -> r -> (forall d. Data d => d -> r') -> SKAddendum -> r)
    -> (forall r r'.
        (r' -> r -> r)
        -> r -> (forall d. Data d => d -> r') -> SKAddendum -> r)
    -> (forall u. (forall d. Data d => d -> u) -> SKAddendum -> [u])
    -> (forall u.
        Int -> (forall d. Data d => d -> u) -> SKAddendum -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d) -> SKAddendum -> m SKAddendum)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> SKAddendum -> m SKAddendum)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> SKAddendum -> m SKAddendum)
    -> Data SKAddendum
    SKAddendum -> Constr
    SKAddendum -> DataType
    (forall b. Data b => b -> b) -> SKAddendum -> SKAddendum
    forall a.
    Typeable a
    -> (forall (c :: * -> *).
        (forall d b. Data d => c (d -> b) -> d -> c b)
        -> (forall g. g -> c g) -> a -> c a)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c a)
    -> (a -> Constr)
    -> (a -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c a))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
    -> ((forall b. Data b => b -> b) -> a -> a)
    -> (forall r r'.
        (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall r r'.
        (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall u. (forall d. Data d => d -> u) -> a -> [u])
    -> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> Data a
    forall u. Int -> (forall d. Data d => d -> u) -> SKAddendum -> u
    forall u. (forall d. Data d => d -> u) -> SKAddendum -> [u]
    forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> SKAddendum -> r
    forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> SKAddendum -> r
    forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> SKAddendum -> m SKAddendum
    forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> SKAddendum -> m SKAddendum
    forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c SKAddendum
    forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> SKAddendum -> c SKAddendum
    forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c SKAddendum)
    forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SKAddendum)
    $cgfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> SKAddendum -> c SKAddendum
    gfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> SKAddendum -> c SKAddendum
    $cgunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c SKAddendum
    gunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c SKAddendum
    $ctoConstr :: SKAddendum -> Constr
    toConstr :: SKAddendum -> Constr
    $cdataTypeOf :: SKAddendum -> DataType
    dataTypeOf :: SKAddendum -> DataType
    $cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c SKAddendum)
    dataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c SKAddendum)
    $cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SKAddendum)
    dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SKAddendum)
    $cgmapT :: (forall b. Data b => b -> b) -> SKAddendum -> SKAddendum
    gmapT :: (forall b. Data b => b -> b) -> SKAddendum -> SKAddendum
    $cgmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> SKAddendum -> r
    gmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> SKAddendum -> r
    $cgmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> SKAddendum -> r
    gmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> SKAddendum -> r
    $cgmapQ :: forall u. (forall d. Data d => d -> u) -> SKAddendum -> [u]
    gmapQ :: forall u. (forall d. Data d => d -> u) -> SKAddendum -> [u]
    $cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> SKAddendum -> u
    gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> SKAddendum -> u
    $cgmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> SKAddendum -> m SKAddendum
    gmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> SKAddendum -> m SKAddendum
    $cgmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> SKAddendum -> m SKAddendum
    gmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> SKAddendum -> m SKAddendum
    $cgmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> SKAddendum -> m SKAddendum
    gmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> SKAddendum -> m SKAddendum
    Data, SKAddendum -> SKAddendum -> Bool
    (SKAddendum -> SKAddendum -> Bool)
    -> (SKAddendum -> SKAddendum -> Bool) -> Eq SKAddendum
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: SKAddendum -> SKAddendum -> Bool
    == :: SKAddendum -> SKAddendum -> Bool
    $c/= :: SKAddendum -> SKAddendum -> Bool
    /= :: SKAddendum -> SKAddendum -> Bool
    Eq, (forall x. SKAddendum -> Rep SKAddendum x)
    -> (forall x. Rep SKAddendum x -> SKAddendum) -> Generic SKAddendum
    forall x. Rep SKAddendum x -> SKAddendum
    forall x. SKAddendum -> Rep SKAddendum x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    $cfrom :: forall x. SKAddendum -> Rep SKAddendum x
    from :: forall x. SKAddendum -> Rep SKAddendum x
    $cto :: forall x. Rep SKAddendum x -> SKAddendum
    to :: forall x. Rep SKAddendum x -> SKAddendum
    Generic, Int -> SKAddendum -> ShowS
    [SKAddendum] -> ShowS
    SKAddendum -> String
    (Int -> SKAddendum -> ShowS)
    -> (SKAddendum -> String)
    -> ([SKAddendum] -> ShowS)
    -> Show SKAddendum
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> SKAddendum -> ShowS
    showsPrec :: Int -> SKAddendum -> ShowS
    $cshow :: SKAddendum -> String
    show :: SKAddendum -> String
    $cshowList :: [SKAddendum] -> ShowS
    showList :: [SKAddendum] -> ShowS
    Show, Typeable)

    instance Ord SKAddendum where
      compare :: SKAddendum -> SKAddendum -> Ordering
    compare SKAddendum
    a SKAddendum
    b = SKAddendum -> String
    forall a. Show a => a -> String
    show SKAddendum
    a String -> String -> Ordering
    forall a. Ord a => a -> a -> Ordering
    `compare` SKAddendum -> String
    forall a. Show a => a -> String
    show SKAddendum
    b -- FIXME: this is ridiculous

    instance Hashable SKAddendum

    instance Pretty SKAddendum where
      pretty :: forall ann. SKAddendum -> Doc ann
    pretty (SUS16bit SymmetricAlgorithm
    sa S2K
    s2k IV
    iv ByteString
    bs) =
        String -> Doc ann
    forall ann. String -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    pretty String
    "SUS16bit" Doc ann -> Doc ann -> Doc ann
    forall ann. Doc ann -> Doc ann -> Doc ann
    <+>
        SymmetricAlgorithm -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    forall ann. SymmetricAlgorithm -> Doc ann
    pretty SymmetricAlgorithm
    sa Doc ann -> Doc ann -> Doc ann
    forall ann. Doc ann -> Doc ann -> Doc ann
    <+> S2K -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    forall ann. S2K -> Doc ann
    pretty S2K
    s2k Doc ann -> Doc ann -> Doc ann
    forall ann. Doc ann -> Doc ann -> Doc ann
    <+> IV -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    forall ann. IV -> Doc ann
    pretty IV
    iv Doc ann -> Doc ann -> Doc ann
    forall ann. Doc ann -> Doc ann -> Doc ann
    <+> String -> Doc ann
    forall ann. String -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    pretty (ByteString -> String
    bsToHexUpper ByteString
    bs)
      pretty (SUSSHA1 SymmetricAlgorithm
    sa S2K
    s2k IV
    iv ByteString
    bs) =
        String -> Doc ann
    forall ann. String -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    pretty String
    "SUSSHA1" Doc ann -> Doc ann -> Doc ann
    forall ann. Doc ann -> Doc ann -> Doc ann
    <+>
        SymmetricAlgorithm -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    forall ann. SymmetricAlgorithm -> Doc ann
    pretty SymmetricAlgorithm
    sa Doc ann -> Doc ann -> Doc ann
    forall ann. Doc ann -> Doc ann -> Doc ann
    <+> S2K -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    forall ann. S2K -> Doc ann
    pretty S2K
    s2k Doc ann -> Doc ann -> Doc ann
    forall ann. Doc ann -> Doc ann -> Doc ann
    <+> IV -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    forall ann. IV -> Doc ann
    pretty IV
    iv Doc ann -> Doc ann -> Doc ann
    forall ann. Doc ann -> Doc ann -> Doc ann
    <+> String -> Doc ann
    forall ann. String -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    pretty (ByteString -> String
    bsToHexUpper ByteString
    bs)
      pretty (SUSym SymmetricAlgorithm
    sa IV
    iv ByteString
    bs) =
        String -> Doc ann
    forall ann. String -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    pretty String
    "SUSym" Doc ann -> Doc ann -> Doc ann
    forall ann. Doc ann -> Doc ann -> Doc ann
    <+> SymmetricAlgorithm -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    forall ann. SymmetricAlgorithm -> Doc ann
    pretty SymmetricAlgorithm
    sa Doc ann -> Doc ann -> Doc ann
    forall ann. Doc ann -> Doc ann -> Doc ann
    <+> IV -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    forall ann. IV -> Doc ann
    pretty IV
    iv Doc ann -> Doc ann -> Doc ann
    forall ann. Doc ann -> Doc ann -> Doc ann
    <+> String -> Doc ann
    forall ann. String -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    pretty (ByteString -> String
    bsToHexUpper ByteString
    bs)
      pretty (SUUnencrypted SKey
    s V3Expiration
    ck) =
        String -> Doc ann
    forall ann. String -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    pretty String
    "SUUnencrypted" Doc ann -> Doc ann -> Doc ann
    forall ann. Doc ann -> Doc ann -> Doc ann
    <+> SKey -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    forall ann. SKey -> Doc ann
    pretty SKey
    s Doc ann -> Doc ann -> Doc ann
    forall ann. Doc ann -> Doc ann -> Doc ann
    <+> V3Expiration -> Doc ann
    forall ann. V3Expiration -> Doc ann
    forall a ann. Pretty a => a -> Doc ann
    pretty V3Expiration
    ck

    instance A.ToJSON SKAddendum where
      toJSON :: SKAddendum -> Value
    toJSON (SUS16bit SymmetricAlgorithm
    sa S2K
    s2k IV
    iv ByteString
    bs) = (SymmetricAlgorithm, S2K, IV, [Word8]) -> Value
    forall a. ToJSON a => a -> Value
    A.toJSON (SymmetricAlgorithm
    sa, S2K
    s2k, IV
    iv, ByteString -> [Word8]
    BL.unpack ByteString
    bs)
      toJSON (SUSSHA1 SymmetricAlgorithm
    sa S2K
    s2k IV
    iv ByteString
    bs) = (SymmetricAlgorithm, S2K, IV, [Word8]) -> Value
    forall a. ToJSON a => a -> Value
    A.toJSON (SymmetricAlgorithm
    sa, S2K
    s2k, IV
    iv, ByteString -> [Word8]
    BL.unpack ByteString
    bs)
      toJSON (SUSym SymmetricAlgorithm
    sa IV
    iv ByteString
    bs) = (SymmetricAlgorithm, IV, [Word8]) -> Value
    forall a. ToJSON a => a -> Value
    A.toJSON (SymmetricAlgorithm
    sa, IV
    iv, ByteString -> [Word8]
    BL.unpack ByteString
    bs)
      toJSON (SUUnencrypted SKey
    s V3Expiration
    ck) = (SKey, V3Expiration) -> Value
    forall a. ToJSON a => a -> Value
    A.toJSON (SKey
    s, V3Expiration
    ck)