-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | ASN.1 types
--   
--   ASN.1 standard types
@package asn1-types
@version 0.3.4

module Data.ASN1.BitArray

-- | represent a bitarray / bitmap
--   
--   the memory representation start at bit 0
data BitArray
BitArray :: Word64 -> ByteString -> BitArray

-- | throwed in case of out of bounds in the bitarray.
data BitArrayOutOfBound
BitArrayOutOfBound :: Word64 -> BitArrayOutOfBound

-- | returns the length of bits in this bitarray
bitArrayLength :: BitArray -> Word64

-- | get the nth bits
bitArrayGetBit :: BitArray -> Word64 -> Bool

-- | set the nth bit to the value specified
bitArraySetBitValue :: BitArray -> Word64 -> Bool -> BitArray

-- | set the nth bits
bitArraySetBit :: BitArray -> Word64 -> BitArray

-- | clear the nth bits
bitArrayClearBit :: BitArray -> Word64 -> BitArray

-- | get padded bytestring of the bitarray
bitArrayGetData :: BitArray -> ByteString

-- | number of bit to skip at the end (padding)
toBitArray :: ByteString -> Int -> BitArray
instance GHC.Classes.Eq Data.ASN1.BitArray.BitArray
instance GHC.Classes.Eq Data.ASN1.BitArray.BitArrayOutOfBound
instance GHC.Internal.Exception.Type.Exception Data.ASN1.BitArray.BitArrayOutOfBound
instance GHC.Internal.Show.Show Data.ASN1.BitArray.BitArray
instance GHC.Internal.Show.Show Data.ASN1.BitArray.BitArrayOutOfBound

module Data.ASN1.OID

-- | Standard ASN.1 Object ID (OID)
type OID = [Integer]

-- | Class of things that have an Object ID
class OIDable a

-- | return the object ID of an Object from the ObjectIdentifiable class.
getObjectID :: OIDable a => a -> OID

-- | Class of things that can be named by Object ID
class OIDNameable a

-- | Try to convert an OID into an Object
fromObjectID :: OIDNameable a => OID -> Maybe a

module Data.ASN1.Types.Lowlevel

-- | Element class
data ASN1Class
Universal :: ASN1Class
Application :: ASN1Class
Context :: ASN1Class
Private :: ASN1Class

-- | ASN1 Tag
type ASN1Tag = Int

-- | ASN1 Length with all different formats
data ASN1Length

-- | Short form with only one byte. length has to be < 127.
LenShort :: Int -> ASN1Length

-- | Long form of N bytes
LenLong :: Int -> Int -> ASN1Length

-- | Length is indefinite expect an EOC in the stream to finish the type
LenIndefinite :: ASN1Length

-- | ASN1 Header with the class, tag, constructed flag and length.
data ASN1Header
ASN1Header :: !ASN1Class -> !ASN1Tag -> !Bool -> !ASN1Length -> ASN1Header

-- | represent one event from an asn1 data stream
data ASN1Event

-- | ASN1 Header
Header :: ASN1Header -> ASN1Event

-- | Primitive
Primitive :: !ByteString -> ASN1Event

-- | Constructed value start
ConstructionBegin :: ASN1Event

-- | Constructed value end
ConstructionEnd :: ASN1Event
instance GHC.Internal.Enum.Enum Data.ASN1.Types.Lowlevel.ASN1Class
instance GHC.Classes.Eq Data.ASN1.Types.Lowlevel.ASN1Class
instance GHC.Classes.Eq Data.ASN1.Types.Lowlevel.ASN1Event
instance GHC.Classes.Eq Data.ASN1.Types.Lowlevel.ASN1Header
instance GHC.Classes.Eq Data.ASN1.Types.Lowlevel.ASN1Length
instance GHC.Classes.Ord Data.ASN1.Types.Lowlevel.ASN1Class
instance GHC.Internal.Show.Show Data.ASN1.Types.Lowlevel.ASN1Class
instance GHC.Internal.Show.Show Data.ASN1.Types.Lowlevel.ASN1Event
instance GHC.Internal.Show.Show Data.ASN1.Types.Lowlevel.ASN1Header
instance GHC.Internal.Show.Show Data.ASN1.Types.Lowlevel.ASN1Length

-- | Different String types available in ASN1
module Data.ASN1.Types.String

-- | Define all possible ASN1 String encoding.
data ASN1StringEncoding

-- | 128 characters equivalent to the ASCII alphabet
IA5 :: ASN1StringEncoding

-- | UTF8
UTF8 :: ASN1StringEncoding

-- | all registered graphic and character sets (see ISO 2375) plus SPACE
--   and DELETE.
General :: ASN1StringEncoding

-- | all registered G sets and SPACE
Graphic :: ASN1StringEncoding

-- | encoding containing numeric [0-9] and space
Numeric :: ASN1StringEncoding

-- | printable [a-z] [A-Z] [()+,-.?:/=] and space.
Printable :: ASN1StringEncoding

-- | CCITT's T.100 and T.101 character sets
VideoTex :: ASN1StringEncoding

-- | International ASCII printing character sets
Visible :: ASN1StringEncoding

-- | teletext
T61 :: ASN1StringEncoding

-- | UTF32
UTF32 :: ASN1StringEncoding

-- | Character
Character :: ASN1StringEncoding

-- | UCS2
BMP :: ASN1StringEncoding

-- | ASN1 Character String with encoding
data ASN1CharacterString
ASN1CharacterString :: ASN1StringEncoding -> ByteString -> ASN1CharacterString
[characterEncoding] :: ASN1CharacterString -> ASN1StringEncoding
[getCharacterStringRawData] :: ASN1CharacterString -> ByteString

-- | encode a string into a character string
asn1CharacterString :: ASN1StringEncoding -> String -> ASN1CharacterString

-- | try to decode an ASN1CharacterString to a String
asn1CharacterToString :: ASN1CharacterString -> Maybe String
instance GHC.Classes.Eq Data.ASN1.Types.String.ASN1CharacterString
instance GHC.Classes.Eq Data.ASN1.Types.String.ASN1StringEncoding
instance GHC.Internal.Data.String.IsString Data.ASN1.Types.String.ASN1CharacterString
instance GHC.Classes.Ord Data.ASN1.Types.String.ASN1CharacterString
instance GHC.Classes.Ord Data.ASN1.Types.String.ASN1StringEncoding
instance GHC.Internal.Show.Show Data.ASN1.Types.String.ASN1CharacterString
instance GHC.Internal.Show.Show Data.ASN1.Types.String.ASN1StringEncoding

module Data.ASN1.Types

-- | Define high level ASN1 object.
data ASN1
Boolean :: Bool -> ASN1
IntVal :: Integer -> ASN1
BitString :: BitArray -> ASN1
OctetString :: ByteString -> ASN1
Null :: ASN1
OID :: OID -> ASN1
Real :: Double -> ASN1
Enumerated :: Integer -> ASN1
ASN1String :: ASN1CharacterString -> ASN1
ASN1Time :: ASN1TimeType -> DateTime -> Maybe TimezoneOffset -> ASN1
Other :: ASN1Class -> ASN1Tag -> ByteString -> ASN1
Start :: ASN1ConstructionType -> ASN1
End :: ASN1ConstructionType -> ASN1

-- | represent a chunk of ASN1 Stream. this is equivalent to ShowS but for
--   an ASN1 Stream.
type ASN1S = [ASN1] -> [ASN1]

-- | Element class
data ASN1Class
Universal :: ASN1Class
Application :: ASN1Class
Context :: ASN1Class
Private :: ASN1Class

-- | ASN1 Tag
type ASN1Tag = Int

-- | Define the type of container
data ASN1ConstructionType
Sequence :: ASN1ConstructionType
Set :: ASN1ConstructionType
Container :: ASN1Class -> ASN1Tag -> ASN1ConstructionType

-- | Define all possible ASN1 String encoding.
data ASN1StringEncoding

-- | 128 characters equivalent to the ASCII alphabet
IA5 :: ASN1StringEncoding

-- | UTF8
UTF8 :: ASN1StringEncoding

-- | all registered graphic and character sets (see ISO 2375) plus SPACE
--   and DELETE.
General :: ASN1StringEncoding

-- | all registered G sets and SPACE
Graphic :: ASN1StringEncoding

-- | encoding containing numeric [0-9] and space
Numeric :: ASN1StringEncoding

-- | printable [a-z] [A-Z] [()+,-.?:/=] and space.
Printable :: ASN1StringEncoding

-- | CCITT's T.100 and T.101 character sets
VideoTex :: ASN1StringEncoding

-- | International ASCII printing character sets
Visible :: ASN1StringEncoding

-- | teletext
T61 :: ASN1StringEncoding

-- | UTF32
UTF32 :: ASN1StringEncoding

-- | Character
Character :: ASN1StringEncoding

-- | UCS2
BMP :: ASN1StringEncoding

-- | Different ASN1 time representation
data ASN1TimeType

-- | ASN1 UTCTime Type: limited between 1950-2050
TimeUTC :: ASN1TimeType

-- | ASN1 GeneralizedTime Type
TimeGeneralized :: ASN1TimeType

-- | Define an object that can be converted to and from ASN.1
class ASN1Object a

-- | transform an object into a chunk of ASN1 stream.
toASN1 :: ASN1Object a => a -> ASN1S

-- | returns either an object along the remaining ASN1 stream, or an error.
fromASN1 :: ASN1Object a => [ASN1] -> Either String (a, [ASN1])

-- | ASN1 Character String with encoding
data ASN1CharacterString
ASN1CharacterString :: ASN1StringEncoding -> ByteString -> ASN1CharacterString
[characterEncoding] :: ASN1CharacterString -> ASN1StringEncoding
[getCharacterStringRawData] :: ASN1CharacterString -> ByteString

-- | encode a string into a character string
asn1CharacterString :: ASN1StringEncoding -> String -> ASN1CharacterString

-- | try to decode an ASN1CharacterString to a String
asn1CharacterToString :: ASN1CharacterString -> Maybe String
instance GHC.Classes.Eq Data.ASN1.Types.ASN1
instance GHC.Classes.Eq Data.ASN1.Types.ASN1ConstructionType
instance GHC.Classes.Eq Data.ASN1.Types.ASN1TimeType
instance GHC.Classes.Ord Data.ASN1.Types.ASN1TimeType
instance GHC.Internal.Show.Show Data.ASN1.Types.ASN1
instance GHC.Internal.Show.Show Data.ASN1.Types.ASN1ConstructionType
instance GHC.Internal.Show.Show Data.ASN1.Types.ASN1TimeType

module Data.ASN1.Pretty

-- | Pretty Print a list of ASN.1 element
pretty :: PrettyType -> [ASN1] -> String
data PrettyType
Multiline :: Int -> PrettyType
SingleLine :: PrettyType
instance GHC.Classes.Eq Data.ASN1.Pretty.PrettyType
instance GHC.Internal.Show.Show Data.ASN1.Pretty.PrettyType
