packages feed

crypto-pubkey-types 0.4.1 → 0.4.2

raw patch · 4 files changed

+69/−11 lines, 4 files

Files

Crypto/Types/PubKey/DSA.hs view
@@ -6,6 +6,9 @@ -- Stability   : Stable -- Portability : Excellent --+-- references:+--   <https://tools.ietf.org/html/rfc6979>+-- module Crypto.Types.PubKey.DSA     ( Params(..)     , Signature(..)
Crypto/Types/PubKey/ECC.hs view
@@ -6,9 +6,14 @@ -- Stability   : Experimental -- Portability : Excellent --+-- references:+--   <https://tools.ietf.org/html/rfc5915>+-- module Crypto.Types.PubKey.ECC     ( Curve(..)     , Point(..)+    , PublicPoint+    , PrivateNumber     , CurveBinary(..)     , CurvePrime(..)     , common_curve@@ -21,12 +26,20 @@     ) where  import Data.Data+import Data.Tuple (swap)+import Data.ASN1.OID  -- | Define either a binary curve or a prime curve. data Curve = CurveF2m CurveBinary -- ^ 𝔽(2^m)            | CurveFP  CurvePrime  -- ^ 𝔽p            deriving (Show,Read,Eq,Data,Typeable) +-- | ECC Public Point+type PublicPoint = Point++-- | ECC Private Number+type PrivateNumber = Integer+ -- | Define a point on a curve. data Point = Point Integer Integer            | PointO -- ^ Point at Infinity@@ -75,11 +88,11 @@     | SEC_p160r1     | SEC_p160r2     | SEC_p192k1-    | SEC_p192r1+    | SEC_p192r1 -- aka prime192v1     | SEC_p224k1     | SEC_p224r1     | SEC_p256k1-    | SEC_p256r1+    | SEC_p256r1 -- aka prime256v1     | SEC_p384r1     | SEC_p521r1     | SEC_t113r1@@ -91,7 +104,7 @@     | SEC_t163r2     | SEC_t193r1     | SEC_t193r2-    | SEC_t233k1+    | SEC_t233k1 -- aka NIST K-233     | SEC_t233r1     | SEC_t239k1     | SEC_t283k1@@ -100,7 +113,51 @@     | SEC_t409r1     | SEC_t571k1     | SEC_t571r1-    deriving (Show,Eq,Ord,Enum)+    deriving (Show,Read,Eq,Ord,Enum,Data,Typeable)++curvesOIDs :: [ (CurveName, OID) ]+curvesOIDs =+    [ (SEC_p112r1, [1,3,132,0,6])+    , (SEC_p112r2, [1,3,132,0,7])+    , (SEC_p128r1, [1,3,132,0,28])+    , (SEC_p128r2, [1,3,132,0,29])+    , (SEC_p160k1, [1,3,132,0,9])+    , (SEC_p160r1, [1,3,132,0,8])+    , (SEC_p160r2, [1,3,132,0,30])+    , (SEC_p192k1, [1,3,132,0,31])+    , (SEC_p192r1, [1,2,840,10045,3,1,1,1])+    , (SEC_p224k1, [1,3,132,0,32])+    , (SEC_p224r1, [1,3,132,0,33])+    , (SEC_p256k1, [1,3,132,0,10])+    , (SEC_p256r1, [1,2,840,10045,3,1,1,7])+    , (SEC_p384r1, [1,3,132,0,34])+    , (SEC_p521r1, [1,3,132,0,35])+    , (SEC_t113r1, [1,3,132,0,4])+    , (SEC_t113r2, [1,3,132,0,5])+    , (SEC_t131r1, [1,3,132,0,22])+    , (SEC_t131r2, [1,3,132,0,23])+    , (SEC_t163k1, [1,3,132,0,1])+    , (SEC_t163r1, [1,3,132,0,2])+    , (SEC_t163r2, [1,3,132,0,15])+    , (SEC_t193r1, [1,3,132,0,24])+    , (SEC_t193r2, [1,3,132,0,25])+    , (SEC_t233k1, [1,3,132,0,26])+    , (SEC_t233r1, [1,3,132,0,27])+    , (SEC_t239k1, [1,3,132,0,3])+    , (SEC_t283k1, [1,3,132,0,16])+    , (SEC_t283r1, [1,3,132,0,17])+    , (SEC_t409k1, [1,3,132,0,36])+    , (SEC_t409r1, [1,3,132,0,37])+    , (SEC_t571k1, [1,3,132,0,38])+    , (SEC_t571r1, [1,3,132,0,39])+    ]++instance OIDable CurveName where+    getObjectID cn = maybe (error ("no oid for: " ++ show cn)) id $ lookup cn curvesOIDs++instance OIDNameable CurveName where+    fromObjectID oid = lookupSnd oid curvesOIDs+      where lookupSnd x = lookup x . map swap  -- | Get the curve definition associated with a recommended known curve name. getCurveByName :: CurveName -> Curve
Crypto/Types/PubKey/ECDSA.hs view
@@ -6,6 +6,10 @@ -- Stability   : Experimental -- Portability : Excellent --+-- references:+--   <https://tools.ietf.org/html/rfc5915>+--   <https://tools.ietf.org/html/rfc6979>+-- module Crypto.Types.PubKey.ECDSA     ( Signature(..)     , PublicPoint@@ -19,12 +23,6 @@  import Crypto.Types.PubKey.ECC import Data.Data---- | ECDSA Public Point, usually embedded in ECDSA Public Key.-type PublicPoint = Point---- | ECDSA Private Number, usually embedded in ECDSA Private Key.-type PrivateNumber = Integer  -- | Represent a ECDSA signature namely R and S. data Signature = Signature
crypto-pubkey-types.cabal view
@@ -1,5 +1,5 @@ Name:                crypto-pubkey-types-Version:             0.4.1+Version:             0.4.2 Description:         Generic cryptography public keys algorithm types License:             BSD3 License-file:        LICENSE