Data.ASN1.BER

asn1-data-0.6.1.2: ASN1 data reader and writer in RAW, BER, DER and CER forms

Portability | unknown
Stability | experimental
Maintainer | Vincent Hanquez <vincent@snarc.org>
Safe Haskell | None

Data.ASN1.BER

Contents

- enumeratee to transform between ASN1 and raw
- enumeratee to transform between ASN1 and bytes
- iterate over common representation to an ASN1 stream
- BER serialize functions
- BER serialize functions, deprecated

Description

A module containing ASN1 BER specification serialization/derialization tools

Synopsis

- data ASN1Class
  - = Universal
  - | Application
  - | Context
  - | Private
- data ASN1
  - = Boolean Bool
  - | IntVal Integer
  - | BitString BitArray
  - | OctetString ByteString
  - | Null
  - | OID [Integer]
  - | Real Double
  - | Enumerated
  - | UTF8String String
  - | NumericString ByteString
  - | PrintableString String
  - | T61String String
  - | VideoTexString ByteString
  - | IA5String String
  - | UTCTime (Int, Int, Int, Int, Int, Int, Bool)
  - | GeneralizedTime (Int, Int, Int, Int, Int, Int, Bool)
  - | GraphicString ByteString
  - | VisibleString ByteString
  - | GeneralString ByteString
  - | UniversalString String
  - | CharacterString ByteString
  - | BMPString String
  - | Other ASN1Class ASN1Tag ByteString
  - | Start ASN1ConstructionType
  - | End ASN1ConstructionType
- data ASN1ConstructionType
  - = Sequence
  - | Set
  - | Container ASN1Class ASN1Tag
- enumReadRawRepr :: Monad m => Enumeratee ASN1Event ASN1Repr m a
- enumReadRaw :: Monad m => Enumeratee ASN1Event ASN1 m a
- enumWriteRaw :: Monad m => Enumeratee ASN1 ASN1Event m a
- enumReadBytes :: Monad m => Enumeratee ByteString ASN1 m a
- enumWriteBytes :: Monad m => Enumeratee ASN1 ByteString m a
- iterateFile :: FilePath -> Iteratee ASN1 IO a -> IO (Either SomeException a)
- iterateByteString :: Monad m => ByteString -> Iteratee ASN1 m a -> m (Either SomeException a)
- iterateByteStringRepr :: Monad m => ByteString -> Iteratee ASN1Repr m a -> m (Either SomeException a)
- iterateEvents :: Monad m => [ASN1Event] -> Iteratee ASN1 m a -> m (Either SomeException a)
- iterateEventsRepr :: Monad m => [ASN1Event] -> Iteratee ASN1Repr m a -> m (Either SomeException a)
- decodeASN1EventsRepr :: [ASN1Event] -> Either ASN1Err [ASN1Repr]
- decodeASN1Events :: [ASN1Event] -> Either ASN1Err [ASN1]
- encodeASN1Events :: [ASN1] -> Either ASN1Err [ASN1Event]
- decodeASN1Stream :: ByteString -> Either ASN1Err [ASN1]
- decodeASN1StreamRepr :: ByteString -> Either ASN1Err [ASN1Repr]
- encodeASN1Stream :: [ASN1] -> Either ASN1Err ByteString
- decodeASN1 :: ByteString -> Either ASN1Err ASN1t
- decodeASN1s :: ByteString -> Either ASN1Err [ASN1t]
- encodeASN1 :: ASN1t -> ByteString
- encodeASN1s :: [ASN1t] -> ByteString

# Documentation

data ASN1Class

Constructors

Universal |
Application |
Context |
Private |

Instances

Enum ASN1Class |
Eq ASN1Class |
Ord ASN1Class |
Show ASN1Class |

data ASN1

Constructors

Boolean Bool |
IntVal Integer |
BitString BitArray |
OctetString ByteString |
Null |
OID [Integer] |
Real Double |
Enumerated |
UTF8String String |
NumericString ByteString |
PrintableString String |
T61String String |
VideoTexString ByteString |
IA5String String |
UTCTime (Int, Int, Int, Int, Int, Int, Bool) |
GeneralizedTime (Int, Int, Int, Int, Int, Int, Bool) |
GraphicString ByteString |
VisibleString ByteString |
GeneralString ByteString |
UniversalString String |
CharacterString ByteString |
BMPString String |
Other ASN1Class ASN1Tag ByteString |
Start ASN1ConstructionType |
End ASN1ConstructionType |

Instances

Eq ASN1 |
Show ASN1 |

data ASN1ConstructionType

Constructors

Sequence |
Set |
Container ASN1Class ASN1Tag |

Instances

Eq ASN1ConstructionType |
Show ASN1ConstructionType |

# enumeratee to transform between ASN1 and raw

enumReadRawRepr :: Monad m => Enumeratee ASN1Event ASN1Repr m a

enumerate from `ASN1Event` to an `ASN1Repr` (ASN1 augmented by a list of raw asn1 events)

enumReadRaw :: Monad m => Enumeratee ASN1Event ASN1 m a

enumeratee from 'Raw.ASN1Event to `ASN1` - - it's the enumerator equivalent: - `enumReadRaw = map fst . enumReadRawRepr`

enumWriteRaw :: Monad m => Enumeratee ASN1 ASN1Event m a

enumWriteRaw is an enumeratee from asn1 to raw events

# enumeratee to transform between ASN1 and bytes

enumReadBytes :: Monad m => Enumeratee ByteString ASN1 m a

enumReadBytes is an enumeratee converting from bytestring to ASN1 it transforms chunks of bytestring into chunks of ASN1 objects

enumWriteBytes :: Monad m => Enumeratee ASN1 ByteString m a

enumWriteBytes is an enumeratee converting from ASN1 to bytestring. it transforms chunks of ASN1 objects into chunks of bytestring

# iterate over common representation to an ASN1 stream

iterateFile :: FilePath -> Iteratee ASN1 IO a -> IO (Either SomeException a)

iterate over a file using a file enumerator.

iterateByteString :: Monad m => ByteString -> Iteratee ASN1 m a -> m (Either SomeException a)

iterate over a bytestring using a list enumerator over each chunks

iterateByteStringRepr :: Monad m => ByteString -> Iteratee ASN1Repr m a -> m (Either SomeException a)

iterate over a bytestring using a list enumerator over each chunks

iterateEvents :: Monad m => [ASN1Event] -> Iteratee ASN1 m a -> m (Either SomeException a)

iterate over asn1 events using a list enumerator over each chunks

iterateEventsRepr :: Monad m => [ASN1Event] -> Iteratee ASN1Repr m a -> m (Either SomeException a)

iterate over asn1 events using a list enumerator over each chunks

# BER serialize functions

decodeASN1EventsRepr :: [ASN1Event] -> Either ASN1Err [ASN1Repr]

decode a list of raw ASN1Events into a stream of ASN1Repr types

decodeASN1Events :: [ASN1Event] -> Either ASN1Err [ASN1]

decode a list of raw ASN1Events into a stream of ASN1 types

encodeASN1Events :: [ASN1] -> Either ASN1Err [ASN1Event]

encode an ASN1 Stream as raw ASN1 Events

decodeASN1Stream :: ByteString -> Either ASN1Err [ASN1]

decode a lazy bytestring as an ASN1 stream

decodeASN1StreamRepr :: ByteString -> Either ASN1Err [ASN1Repr]

decode a lazy bytestring as an ASN1repr stream

encodeASN1Stream :: [ASN1] -> Either ASN1Err ByteString

encode an ASN1 Stream as lazy bytestring

# BER serialize functions, deprecated

decodeASN1 :: ByteString -> Either ASN1Err ASN1t

Deprecated: use stream types with decodeASN1Stream

decodeASN1s :: ByteString -> Either ASN1Err [ASN1t]

Deprecated: use stream types with decodeASN1Stream

encodeASN1 :: ASN1t -> ByteString

Deprecated: use stream types with encodeASN1Stream

encodeASN1s :: [ASN1t] -> ByteString

Deprecated: use stream types with encodeASN1Stream