    -- |
    -- Module      : Data.X509.OID
    -- License     : BSD-style
    -- Maintainer  : Vincent Hanquez <vincent@snarc.org>
    -- Stability   : experimental
    -- Portability : unknown
    --
    module Data.X509.OID
        ( OIDTable
        , lookupByOID
        , lookupOID
        , curvesOIDTable
        ) where

    import Control.Applicative
    import Crypto.PubKey.ECC.Types
    import Data.ASN1.OID
    import Data.List (find)

    type OIDTable a = [(a,OID)]

    lookupByOID :: OIDTable a -> OID -> Maybe a
    lookupByOID :: OIDTable a -> OID -> Maybe a
    lookupByOID table :: OIDTable a
    table oid :: OID
    oid = (a, OID) -> a
    forall a b. (a, b) -> a
    fst ((a, OID) -> a) -> Maybe (a, OID) -> Maybe a
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> ((a, OID) -> Bool) -> OIDTable a -> Maybe (a, OID)
    forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Maybe a
    find (OID -> OID -> Bool
    forall a. Eq a => a -> a -> Bool
    (==) OID
    oid (OID -> Bool) -> ((a, OID) -> OID) -> (a, OID) -> Bool
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (a, OID) -> OID
    forall a b. (a, b) -> b
    snd) OIDTable a
    table

    lookupOID :: Eq a => OIDTable a -> a -> Maybe OID
    lookupOID :: OIDTable a -> a -> Maybe OID
    lookupOID table :: OIDTable a
    table a :: a
    a = a -> OIDTable a -> Maybe OID
    forall a b. Eq a => a -> [(a, b)] -> Maybe b
    lookup a
    a OIDTable a
    table

    curvesOIDTable :: OIDTable CurveName
    curvesOIDTable :: OIDTable CurveName
    curvesOIDTable =
        [ (CurveName
    SEC_p112r1, [1,3,132,0,6])
        , (CurveName
    SEC_p112r2, [1,3,132,0,7])
        , (CurveName
    SEC_p128r1, [1,3,132,0,28])
        , (CurveName
    SEC_p128r2, [1,3,132,0,29])
        , (CurveName
    SEC_p160k1, [1,3,132,0,9])
        , (CurveName
    SEC_p160r1, [1,3,132,0,8])
        , (CurveName
    SEC_p160r2, [1,3,132,0,30])
        , (CurveName
    SEC_p192k1, [1,3,132,0,31])
        , (CurveName
    SEC_p192r1, [1,2,840,10045,3,1,1])
        , (CurveName
    SEC_p224k1, [1,3,132,0,32])
        , (CurveName
    SEC_p224r1, [1,3,132,0,33])
        , (CurveName
    SEC_p256k1, [1,3,132,0,10])
        , (CurveName
    SEC_p256r1, [1,2,840,10045,3,1,7])
        , (CurveName
    SEC_p384r1, [1,3,132,0,34])
        , (CurveName
    SEC_p521r1, [1,3,132,0,35])
        , (CurveName
    SEC_t113r1, [1,3,132,0,4])
        , (CurveName
    SEC_t113r2, [1,3,132,0,5])
        , (CurveName
    SEC_t131r1, [1,3,132,0,22])
        , (CurveName
    SEC_t131r2, [1,3,132,0,23])
        , (CurveName
    SEC_t163k1, [1,3,132,0,1])
        , (CurveName
    SEC_t163r1, [1,3,132,0,2])
        , (CurveName
    SEC_t163r2, [1,3,132,0,15])
        , (CurveName
    SEC_t193r1, [1,3,132,0,24])
        , (CurveName
    SEC_t193r2, [1,3,132,0,25])
        , (CurveName
    SEC_t233k1, [1,3,132,0,26])
        , (CurveName
    SEC_t233r1, [1,3,132,0,27])
        , (CurveName
    SEC_t239k1, [1,3,132,0,3])
        , (CurveName
    SEC_t283k1, [1,3,132,0,16])
        , (CurveName
    SEC_t283r1, [1,3,132,0,17])
        , (CurveName
    SEC_t409k1, [1,3,132,0,36])
        , (CurveName
    SEC_t409r1, [1,3,132,0,37])
        , (CurveName
    SEC_t571k1, [1,3,132,0,38])
        , (CurveName
    SEC_t571r1, [1,3,132,0,39])
        ]