module Crypto.Types.PubKey.DH
( Params(..)
, PublicNumber(..)
, PrivateNumber(..)
, SharedKey(..)
) where
import Data.Data
import Data.ASN1.Types
data Params = Params
{ params_p :: Integer
, params_g :: Integer
} deriving (Show,Read,Eq,Data,Typeable)
instance ASN1Object Params where
toASN1 params = \xs -> Start Sequence
: IntVal (params_p params)
: IntVal (params_g params)
: End Sequence
: xs
fromASN1 (Start Sequence:IntVal p:IntVal g:End Sequence:xs) =
Right (Params { params_p = p, params_g = g }, xs)
fromASN1 _ = Left "fromASN1: DH.Params: unexpected format"
newtype PublicNumber = PublicNumber Integer
deriving (Show,Read,Eq,Enum,Real,Num,Ord)
newtype PrivateNumber = PrivateNumber Integer
deriving (Show,Read,Eq,Enum,Real,Num,Ord)
newtype SharedKey = SharedKey Integer
deriving (Show,Read,Eq,Enum,Real,Num,Ord)