module Data.X509.PrivateKey
( PrivKey(..)
, PrivKeyEC(..)
, privkeyToAlg
) where
import Data.X509.AlgorithmIdentifier
import Data.X509.PublicKey (SerializedPoint(..))
import qualified Crypto.PubKey.RSA as RSA
import qualified Crypto.PubKey.DSA as DSA
import qualified Crypto.PubKey.ECC.Types as ECC
data PrivKeyEC =
PrivKeyEC_Prime
{ privkeyEC_priv :: Integer
, privkeyEC_a :: Integer
, privkeyEC_b :: Integer
, privkeyEC_prime :: Integer
, privkeyEC_generator :: SerializedPoint
, privkeyEC_order :: Integer
, privkeyEC_cofactor :: Integer
, privkeyEC_seed :: Integer
}
| PrivKeyEC_Named
{ privkeyEC_name :: ECC.CurveName
, privkeyEC_priv :: Integer
}
deriving (Show,Eq)
data PrivKey =
PrivKeyRSA RSA.PrivateKey
| PrivKeyDSA DSA.PrivateKey
| PrivKeyEC PrivKeyEC
deriving (Show,Eq)
privkeyToAlg :: PrivKey -> PubKeyALG
privkeyToAlg (PrivKeyRSA _) = PubKeyALG_RSA
privkeyToAlg (PrivKeyDSA _) = PubKeyALG_DSA
privkeyToAlg (PrivKeyEC _) = PubKeyALG_EC