packages feed

hOpenPGP 2.9.8 → 2.10.0

raw patch · 10 files changed

+226/−226 lines, 10 filesdep +cryptondep −cryptonitedep ~incremental-parser

Dependencies added: crypton

Dependencies removed: cryptonite

Dependency ranges changed: incremental-parser

Files

Codec/Encryption/OpenPGP/BlockCipher.hs view
@@ -1,5 +1,5 @@ -- BlockCipher.hs: OpenPGP (RFC4880) block cipher stuff--- Copyright © 2013-2016  Clint Adams+-- Copyright © 2013-2024  Clint Adams -- This software is released under the terms of the Expat license. -- (See the LICENSE file). {-# LANGUAGE RankNTypes #-}@@ -10,7 +10,7 @@   ) where  import Codec.Encryption.OpenPGP.Internal.CryptoCipherTypes (HOWrappedOldCCT(..))-import Codec.Encryption.OpenPGP.Internal.Cryptonite (HOWrappedCCT(..))+import Codec.Encryption.OpenPGP.Internal.Crypton (HOWrappedCCT(..)) import Codec.Encryption.OpenPGP.Internal.HOBlockCipher import Codec.Encryption.OpenPGP.Types 
Codec/Encryption/OpenPGP/Internal/CryptoCipherTypes.hs view
@@ -1,5 +1,5 @@ -- CryptoCipherTypes.hs: shim for crypto-cipher-types stuff (current nettle)--- Copyright © 2016  Clint Adams+-- Copyright © 2016-2024  Clint Adams -- This software is released under the terms of the Expat license. -- (See the LICENSE file). {-# LANGUAGE FlexibleInstances #-}@@ -12,7 +12,7 @@  import Control.Error.Util (note) import qualified "crypto-cipher-types" Crypto.Cipher.Types as OldCCT-import qualified "cryptonite" Crypto.Cipher.Types as CCT+import qualified "crypton" Crypto.Cipher.Types as CCT import qualified Data.ByteString as B  import Codec.Encryption.OpenPGP.Internal.HOBlockCipher
+ Codec/Encryption/OpenPGP/Internal/Crypton.hs view
@@ -0,0 +1,37 @@+-- Crypton.hs: shim for crypton+-- Copyright © 2016-2024  Clint Adams+-- This software is released under the terms of the Expat license.+-- (See the LICENSE file).+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE UndecidableInstances #-}++module Codec.Encryption.OpenPGP.Internal.Crypton+  ( HOWrappedCCT(..)+  ) where++import Control.Error.Util (note)+import qualified "crypton" Crypto.Cipher.Types as CCT+import qualified Crypto.Error as CE+import Data.Bifunctor (bimap)+import qualified Data.ByteString as B++import Codec.Encryption.OpenPGP.Internal.HOBlockCipher++newtype HOWrappedCCT a =+  HWCCT a++instance CCT.BlockCipher cipher => HOBlockCipher (HOWrappedCCT cipher) where+  cipherInit = bimap show HWCCT . CE.eitherCryptoError . CCT.cipherInit+  cipherName (HWCCT c) = CCT.cipherName c+  cipherKeySize (HWCCT c) = CCT.cipherKeySize c+  blockSize (HWCCT c) = CCT.blockSize c+  cfbEncrypt (HWCCT c) iv bs =+    hammerIV iv >>= \i -> return (CCT.cfbEncrypt c i bs)+  cfbDecrypt (HWCCT c) iv bs =+    hammerIV iv >>= \i -> return (CCT.cfbDecrypt c i bs)++hammerIV ::+     CCT.BlockCipher cipher => B.ByteString -> Either String (CCT.IV cipher)+hammerIV = note "crypton bad IV" . CCT.makeIV
− Codec/Encryption/OpenPGP/Internal/Cryptonite.hs
@@ -1,37 +0,0 @@--- Cryptonite.hs: shim for cryptonite--- Copyright © 2016  Clint Adams--- This software is released under the terms of the Expat license.--- (See the LICENSE file).-{-# LANGUAGE FlexibleInstances #-}-{-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE PackageImports #-}-{-# LANGUAGE UndecidableInstances #-}--module Codec.Encryption.OpenPGP.Internal.Cryptonite-  ( HOWrappedCCT(..)-  ) where--import Control.Error.Util (note)-import qualified "cryptonite" Crypto.Cipher.Types as CCT-import qualified Crypto.Error as CE-import Data.Bifunctor (bimap)-import qualified Data.ByteString as B--import Codec.Encryption.OpenPGP.Internal.HOBlockCipher--newtype HOWrappedCCT a =-  HWCCT a--instance CCT.BlockCipher cipher => HOBlockCipher (HOWrappedCCT cipher) where-  cipherInit = bimap show HWCCT . CE.eitherCryptoError . CCT.cipherInit-  cipherName (HWCCT c) = CCT.cipherName c-  cipherKeySize (HWCCT c) = CCT.cipherKeySize c-  blockSize (HWCCT c) = CCT.blockSize c-  cfbEncrypt (HWCCT c) iv bs =-    hammerIV iv >>= \i -> return (CCT.cfbEncrypt c i bs)-  cfbDecrypt (HWCCT c) iv bs =-    hammerIV iv >>= \i -> return (CCT.cfbDecrypt c i bs)--hammerIV ::-     CCT.BlockCipher cipher => B.ByteString -> Either String (CCT.IV cipher)-hammerIV = note "cryptonite bad IV" . CCT.makeIV
Codec/Encryption/OpenPGP/Internal/HOBlockCipher.hs view
@@ -1,5 +1,5 @@ -- HOBlockCipher.hs: abstraction for the different BlockCipher classes, plus crazy CFB mode stuff--- Copyright © 2016  Clint Adams+-- Copyright © 2016-2024  Clint Adams -- This software is released under the terms of the Expat license. -- (See the LICENSE file). {-# LANGUAGE PackageImports #-}@@ -8,7 +8,7 @@   ( HOBlockCipher(..)   ) where -import qualified "cryptonite" Crypto.Cipher.Types as CCT+import qualified "crypton" Crypto.Cipher.Types as CCT  import qualified Data.ByteString as B 
Codec/Encryption/OpenPGP/Types.hs view
@@ -1,5 +1,5 @@ -- Types.hs: OpenPGP (RFC4880) data types--- Copyright © 2012-2016  Clint Adams+-- Copyright © 2012-2024  Clint Adams -- This software is released under the terms of the Expat license. -- (See the LICENSE file). module Codec.Encryption.OpenPGP.Types@@ -7,7 +7,7 @@   ) where  import Codec.Encryption.OpenPGP.Types.Internal.Base as X-import Codec.Encryption.OpenPGP.Types.Internal.CryptoniteNewtypes as X+import Codec.Encryption.OpenPGP.Types.Internal.CryptonNewtypes as X import Codec.Encryption.OpenPGP.Types.Internal.PKITypes as X import Codec.Encryption.OpenPGP.Types.Internal.PacketClass as X import Codec.Encryption.OpenPGP.Types.Internal.Pkt as X
+ Codec/Encryption/OpenPGP/Types/Internal/CryptonNewtypes.hs view
@@ -0,0 +1,171 @@+-- CryptonNewtypes.hs: OpenPGP (RFC4880) newtype wrappers for some crypton types+-- Copyright © 2012-2024  Clint Adams+-- This software is released under the terms of the Expat license.+-- (See the LICENSE file).+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}++module Codec.Encryption.OpenPGP.Types.Internal.CryptonNewtypes where++import GHC.Generics (Generic)++import Control.Monad (mzero)+import qualified Crypto.PubKey.DSA as DSA+import qualified Crypto.PubKey.ECC.ECDSA as ECDSA+import qualified Crypto.PubKey.ECC.Types as ECCT+import qualified Crypto.PubKey.RSA as RSA+import qualified Data.Aeson as A+import Data.Data (Data)+import Data.Hashable (Hashable(..))+import Data.Typeable (Typeable)+import Prettyprinter (Pretty(..), (<+>), tupled)++newtype DSA_PublicKey =+  DSA_PublicKey+    { unDSA_PublicKey :: DSA.PublicKey+    }+  deriving (Data, Eq, Generic, Show, Typeable)++instance Ord DSA_PublicKey++instance A.ToJSON DSA_PublicKey where+  toJSON (DSA_PublicKey (DSA.PublicKey p y)) = A.toJSON (DSA_Params p, y)++instance Pretty DSA_PublicKey where+  pretty (DSA_PublicKey (DSA.PublicKey p y)) =+    pretty (DSA_Params p) <+> pretty y++newtype RSA_PublicKey =+  RSA_PublicKey+    { unRSA_PublicKey :: RSA.PublicKey+    }+  deriving (Data, Eq, Generic, Show, Typeable)++instance Ord RSA_PublicKey++instance A.ToJSON RSA_PublicKey where+  toJSON (RSA_PublicKey (RSA.PublicKey size n e)) = A.toJSON (size, n, e)++instance Pretty RSA_PublicKey where+  pretty (RSA_PublicKey (RSA.PublicKey size n e)) =+    pretty size <+> pretty n <+> pretty e++newtype ECDSA_PublicKey =+  ECDSA_PublicKey+    { unECDSA_PublicKey :: ECDSA.PublicKey+    }+  deriving (Data, Eq, Generic, Show, Typeable)++instance Ord ECDSA_PublicKey++instance A.ToJSON ECDSA_PublicKey where+  toJSON (ECDSA_PublicKey (ECDSA.PublicKey curve q)) =+    A.toJSON (show curve, show q)++instance Pretty ECDSA_PublicKey where+  pretty (ECDSA_PublicKey (ECDSA.PublicKey curve q)) =+    pretty (show curve, show q)++newtype DSA_PrivateKey =+  DSA_PrivateKey+    { unDSA_PrivateKey :: DSA.PrivateKey+    }+  deriving (Data, Eq, Generic, Show, Typeable)++instance Ord DSA_PrivateKey++instance A.ToJSON DSA_PrivateKey where+  toJSON (DSA_PrivateKey (DSA.PrivateKey p x)) = A.toJSON (DSA_Params p, x)++instance Pretty DSA_PrivateKey where+  pretty (DSA_PrivateKey (DSA.PrivateKey p x)) = pretty (DSA_Params p, x)++newtype RSA_PrivateKey =+  RSA_PrivateKey+    { unRSA_PrivateKey :: RSA.PrivateKey+    }+  deriving (Data, Eq, Generic, Show, Typeable)++instance Ord RSA_PrivateKey++instance A.ToJSON RSA_PrivateKey where+  toJSON (RSA_PrivateKey (RSA.PrivateKey pub d p q dP dQ qinv)) =+    A.toJSON (RSA_PublicKey pub, d, p, q, dP, dQ, qinv)++instance Pretty RSA_PrivateKey where+  pretty (RSA_PrivateKey (RSA.PrivateKey pub d p q dP dQ qinv)) =+    pretty (RSA_PublicKey pub) <+> tupled (map pretty [d, p, q, dP, dQ, qinv])++newtype ECDSA_PrivateKey =+  ECDSA_PrivateKey+    { unECDSA_PrivateKey :: ECDSA.PrivateKey+    }+  deriving (Data, Eq, Generic, Show, Typeable)++instance Ord ECDSA_PrivateKey++instance A.ToJSON ECDSA_PrivateKey where+  toJSON (ECDSA_PrivateKey (ECDSA.PrivateKey curve d)) =+    A.toJSON (show curve, show d)++instance Pretty ECDSA_PrivateKey where+  pretty (ECDSA_PrivateKey (ECDSA.PrivateKey curve d)) =+    pretty (show curve, show d)++newtype DSA_Params =+  DSA_Params+    { unDSA_Params :: DSA.Params+    }+  deriving (Data, Eq, Generic, Show, Typeable)++instance A.ToJSON DSA_Params where+  toJSON (DSA_Params (DSA.Params p g q)) = A.toJSON (p, g, q)++instance Pretty DSA_Params where+  pretty (DSA_Params (DSA.Params p g q)) = pretty (p, g, q)++instance Hashable DSA_Params where+  hashWithSalt s (DSA_Params (DSA.Params p g q)) =+    s `hashWithSalt` p `hashWithSalt` g `hashWithSalt` q++instance Hashable DSA_PublicKey where+  hashWithSalt s (DSA_PublicKey (DSA.PublicKey p y)) =+    s `hashWithSalt` DSA_Params p `hashWithSalt` y++instance Hashable DSA_PrivateKey where+  hashWithSalt s (DSA_PrivateKey (DSA.PrivateKey p x)) =+    s `hashWithSalt` DSA_Params p `hashWithSalt` x++instance Hashable RSA_PublicKey where+  hashWithSalt s (RSA_PublicKey (RSA.PublicKey size n e)) =+    s `hashWithSalt` size `hashWithSalt` n `hashWithSalt` e++instance Hashable RSA_PrivateKey where+  hashWithSalt s (RSA_PrivateKey (RSA.PrivateKey pub d p q dP dQ qinv)) =+    s `hashWithSalt` RSA_PublicKey pub `hashWithSalt` d `hashWithSalt` p `hashWithSalt`+    q `hashWithSalt`+    dP `hashWithSalt`+    dQ `hashWithSalt`+    qinv++instance Hashable ECDSA_PublicKey where+  hashWithSalt s (ECDSA_PublicKey (ECDSA.PublicKey curve q)) =+    s `hashWithSalt` show curve `hashWithSalt` show q -- FIXME: don't use show++instance Hashable ECDSA_PrivateKey where+  hashWithSalt s (ECDSA_PrivateKey (ECDSA.PrivateKey curve d)) =+    s `hashWithSalt` show curve `hashWithSalt` show d -- FIXME: don't use show++newtype ECurvePoint =+  ECurvePoint+    { unECurvepoint :: ECCT.Point+    }+  deriving (Data, Eq, Generic, Show, Typeable)++instance A.ToJSON ECurvePoint where+  toJSON (ECurvePoint (ECCT.Point x y)) = A.toJSON (x, y)+  toJSON (ECurvePoint ECCT.PointO) = A.toJSON "point at infinity"++instance A.FromJSON ECurvePoint where+  parseJSON (A.Object v) = error "FIXME: whatsit"+  parseJSON _ = mzero
− Codec/Encryption/OpenPGP/Types/Internal/CryptoniteNewtypes.hs
@@ -1,171 +0,0 @@--- CryptoniteNewtypes.hs: OpenPGP (RFC4880) newtype wrappers for some cryptonite types--- Copyright © 2012-2022  Clint Adams--- This software is released under the terms of the Expat license.--- (See the LICENSE file).-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}--module Codec.Encryption.OpenPGP.Types.Internal.CryptoniteNewtypes where--import GHC.Generics (Generic)--import Control.Monad (mzero)-import qualified Crypto.PubKey.DSA as DSA-import qualified Crypto.PubKey.ECC.ECDSA as ECDSA-import qualified Crypto.PubKey.ECC.Types as ECCT-import qualified Crypto.PubKey.RSA as RSA-import qualified Data.Aeson as A-import Data.Data (Data)-import Data.Hashable (Hashable(..))-import Data.Typeable (Typeable)-import Prettyprinter (Pretty(..), (<+>), tupled)--newtype DSA_PublicKey =-  DSA_PublicKey-    { unDSA_PublicKey :: DSA.PublicKey-    }-  deriving (Data, Eq, Generic, Show, Typeable)--instance Ord DSA_PublicKey--instance A.ToJSON DSA_PublicKey where-  toJSON (DSA_PublicKey (DSA.PublicKey p y)) = A.toJSON (DSA_Params p, y)--instance Pretty DSA_PublicKey where-  pretty (DSA_PublicKey (DSA.PublicKey p y)) =-    pretty (DSA_Params p) <+> pretty y--newtype RSA_PublicKey =-  RSA_PublicKey-    { unRSA_PublicKey :: RSA.PublicKey-    }-  deriving (Data, Eq, Generic, Show, Typeable)--instance Ord RSA_PublicKey--instance A.ToJSON RSA_PublicKey where-  toJSON (RSA_PublicKey (RSA.PublicKey size n e)) = A.toJSON (size, n, e)--instance Pretty RSA_PublicKey where-  pretty (RSA_PublicKey (RSA.PublicKey size n e)) =-    pretty size <+> pretty n <+> pretty e--newtype ECDSA_PublicKey =-  ECDSA_PublicKey-    { unECDSA_PublicKey :: ECDSA.PublicKey-    }-  deriving (Data, Eq, Generic, Show, Typeable)--instance Ord ECDSA_PublicKey--instance A.ToJSON ECDSA_PublicKey where-  toJSON (ECDSA_PublicKey (ECDSA.PublicKey curve q)) =-    A.toJSON (show curve, show q)--instance Pretty ECDSA_PublicKey where-  pretty (ECDSA_PublicKey (ECDSA.PublicKey curve q)) =-    pretty (show curve, show q)--newtype DSA_PrivateKey =-  DSA_PrivateKey-    { unDSA_PrivateKey :: DSA.PrivateKey-    }-  deriving (Data, Eq, Generic, Show, Typeable)--instance Ord DSA_PrivateKey--instance A.ToJSON DSA_PrivateKey where-  toJSON (DSA_PrivateKey (DSA.PrivateKey p x)) = A.toJSON (DSA_Params p, x)--instance Pretty DSA_PrivateKey where-  pretty (DSA_PrivateKey (DSA.PrivateKey p x)) = pretty (DSA_Params p, x)--newtype RSA_PrivateKey =-  RSA_PrivateKey-    { unRSA_PrivateKey :: RSA.PrivateKey-    }-  deriving (Data, Eq, Generic, Show, Typeable)--instance Ord RSA_PrivateKey--instance A.ToJSON RSA_PrivateKey where-  toJSON (RSA_PrivateKey (RSA.PrivateKey pub d p q dP dQ qinv)) =-    A.toJSON (RSA_PublicKey pub, d, p, q, dP, dQ, qinv)--instance Pretty RSA_PrivateKey where-  pretty (RSA_PrivateKey (RSA.PrivateKey pub d p q dP dQ qinv)) =-    pretty (RSA_PublicKey pub) <+> tupled (map pretty [d, p, q, dP, dQ, qinv])--newtype ECDSA_PrivateKey =-  ECDSA_PrivateKey-    { unECDSA_PrivateKey :: ECDSA.PrivateKey-    }-  deriving (Data, Eq, Generic, Show, Typeable)--instance Ord ECDSA_PrivateKey--instance A.ToJSON ECDSA_PrivateKey where-  toJSON (ECDSA_PrivateKey (ECDSA.PrivateKey curve d)) =-    A.toJSON (show curve, show d)--instance Pretty ECDSA_PrivateKey where-  pretty (ECDSA_PrivateKey (ECDSA.PrivateKey curve d)) =-    pretty (show curve, show d)--newtype DSA_Params =-  DSA_Params-    { unDSA_Params :: DSA.Params-    }-  deriving (Data, Eq, Generic, Show, Typeable)--instance A.ToJSON DSA_Params where-  toJSON (DSA_Params (DSA.Params p g q)) = A.toJSON (p, g, q)--instance Pretty DSA_Params where-  pretty (DSA_Params (DSA.Params p g q)) = pretty (p, g, q)--instance Hashable DSA_Params where-  hashWithSalt s (DSA_Params (DSA.Params p g q)) =-    s `hashWithSalt` p `hashWithSalt` g `hashWithSalt` q--instance Hashable DSA_PublicKey where-  hashWithSalt s (DSA_PublicKey (DSA.PublicKey p y)) =-    s `hashWithSalt` DSA_Params p `hashWithSalt` y--instance Hashable DSA_PrivateKey where-  hashWithSalt s (DSA_PrivateKey (DSA.PrivateKey p x)) =-    s `hashWithSalt` DSA_Params p `hashWithSalt` x--instance Hashable RSA_PublicKey where-  hashWithSalt s (RSA_PublicKey (RSA.PublicKey size n e)) =-    s `hashWithSalt` size `hashWithSalt` n `hashWithSalt` e--instance Hashable RSA_PrivateKey where-  hashWithSalt s (RSA_PrivateKey (RSA.PrivateKey pub d p q dP dQ qinv)) =-    s `hashWithSalt` RSA_PublicKey pub `hashWithSalt` d `hashWithSalt` p `hashWithSalt`-    q `hashWithSalt`-    dP `hashWithSalt`-    dQ `hashWithSalt`-    qinv--instance Hashable ECDSA_PublicKey where-  hashWithSalt s (ECDSA_PublicKey (ECDSA.PublicKey curve q)) =-    s `hashWithSalt` show curve `hashWithSalt` show q -- FIXME: don't use show--instance Hashable ECDSA_PrivateKey where-  hashWithSalt s (ECDSA_PrivateKey (ECDSA.PrivateKey curve d)) =-    s `hashWithSalt` show curve `hashWithSalt` show d -- FIXME: don't use show--newtype ECurvePoint =-  ECurvePoint-    { unECurvepoint :: ECCT.Point-    }-  deriving (Data, Eq, Generic, Show, Typeable)--instance A.ToJSON ECurvePoint where-  toJSON (ECurvePoint (ECCT.Point x y)) = A.toJSON (x, y)-  toJSON (ECurvePoint ECCT.PointO) = A.toJSON "point at infinity"--instance A.FromJSON ECurvePoint where-  parseJSON (A.Object v) = error "FIXME: whatsit"-  parseJSON _ = mzero
Codec/Encryption/OpenPGP/Types/Internal/PKITypes.hs view
@@ -1,5 +1,5 @@ -- PKITypes.hs: OpenPGP (RFC4880) data types for public/secret keys--- Copyright © 2012-2022  Clint Adams+-- Copyright © 2012-2024  Clint Adams -- This software is released under the terms of the Expat license. -- (See the LICENSE file). {-# LANGUAGE DataKinds #-}@@ -13,7 +13,7 @@ import GHC.Generics (Generic)  import Codec.Encryption.OpenPGP.Types.Internal.Base-import Codec.Encryption.OpenPGP.Types.Internal.CryptoniteNewtypes+import Codec.Encryption.OpenPGP.Types.Internal.CryptonNewtypes  import qualified Data.Aeson as A import qualified Data.Aeson.TH as ATH
hOpenPGP.cabal view
@@ -1,6 +1,6 @@-Cabal-version:       2.2+Cabal-version:       3.4 Name:                hOpenPGP-Version:             2.9.8+Version:             2.10.0 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@@ -8,7 +8,7 @@ License-file:        LICENSE Author:              Clint Adams Maintainer:          Clint Adams <clint@debian.org>-Copyright:           2012-2022  Clint Adams+Copyright:           2012-2024  Clint Adams Category:            Codec, Data Build-type:          Simple Extra-source-files: tests/suite.hs@@ -170,11 +170,11 @@                , conduit               >= 1.3.0                , conduit-extra         >= 1.1                , containers-               , cryptonite            >= 0.11+               , crypton                , crypto-cipher-types                , errors                , hashable-               , incremental-parser+               , incremental-parser    >= 0.5.1                , ixset-typed                , lens                  >= 3.0                , memory@@ -217,10 +217,10 @@ common internalmods   other-modules:       Codec.Encryption.OpenPGP.Internal                      , Codec.Encryption.OpenPGP.Internal.CryptoCipherTypes-                     , Codec.Encryption.OpenPGP.Internal.Cryptonite+                     , Codec.Encryption.OpenPGP.Internal.Crypton                      , Codec.Encryption.OpenPGP.Internal.HOBlockCipher                      , Codec.Encryption.OpenPGP.Types.Internal.Base-                     , Codec.Encryption.OpenPGP.Types.Internal.CryptoniteNewtypes+                     , Codec.Encryption.OpenPGP.Types.Internal.CryptonNewtypes                      , Codec.Encryption.OpenPGP.Types.Internal.PKITypes                      , Codec.Encryption.OpenPGP.Types.Internal.PacketClass                      , Codec.Encryption.OpenPGP.Types.Internal.Pkt@@ -285,4 +285,4 @@ source-repository this   type:     git   location: https://salsa.debian.org/clint/hOpenPGP.git-  tag:      v2.9.8+  tag:      v2.10.0