module Data.ASN1.Types
( ASN1(..)
, ASN1S
, ASN1Class(..)
, ASN1Tag
, ASN1ConstructionType(..)
, ASN1StringEncoding(..)
, ASN1TimeType(..)
, ASN1Object(..)
, ASN1CharacterString(..)
, asn1CharacterString
, asn1CharacterToString
, module Data.ASN1.OID
) where
import Data.Time.Clock (UTCTime)
import Data.Time.LocalTime (TimeZone)
import Data.ASN1.BitArray
import Data.ASN1.OID
import Data.ASN1.Types.Lowlevel
import Data.ASN1.Types.String
import Data.ByteString (ByteString)
data ASN1ConstructionType = Sequence
| Set
| Container ASN1Class ASN1Tag
deriving (Show,Eq)
data ASN1TimeType = TimeUTC
| TimeGeneralized
deriving (Show,Eq,Ord)
data ASN1 =
Boolean Bool
| IntVal Integer
| BitString BitArray
| OctetString ByteString
| Null
| OID OID
| Real Double
| Enumerated Integer
| ASN1String ASN1CharacterString
| ASN1Time ASN1TimeType UTCTime (Maybe TimeZone)
| Other ASN1Class ASN1Tag ByteString
| Start ASN1ConstructionType
| End ASN1ConstructionType
deriving (Show, Eq)
type ASN1S = [ASN1] -> [ASN1]
class ASN1Object a where
toASN1 :: a -> ASN1S
fromASN1 :: [ASN1] -> Either String (a, [ASN1])