module Data.ASN1.Encoding
(
ASN1Decoding(..)
, ASN1DecodingRepr(..)
, ASN1Encoding(..)
, decodeASN1'
, decodeASN1Repr'
, encodeASN1'
) where
import qualified Data.ByteString as B
import qualified Data.ByteString.Lazy as L
import Data.ASN1.Stream
import Data.ASN1.Types
import Data.ASN1.Error
class ASN1Decoding a where
decodeASN1 :: a -> L.ByteString -> Either ASN1Error [ASN1]
class ASN1DecodingRepr a where
decodeASN1Repr :: a -> L.ByteString -> Either ASN1Error [ASN1Repr]
class ASN1Encoding a where
encodeASN1 :: a -> [ASN1] -> L.ByteString
decodeASN1' :: ASN1Decoding a => a -> B.ByteString -> Either ASN1Error [ASN1]
decodeASN1' encoding bs = decodeASN1 encoding $ L.fromChunks [bs]
decodeASN1Repr' :: ASN1DecodingRepr a => a -> B.ByteString -> Either ASN1Error [ASN1Repr]
decodeASN1Repr' encoding bs = decodeASN1Repr encoding $ L.fromChunks [bs]
encodeASN1' :: ASN1Encoding a => a -> [ASN1] -> B.ByteString
encodeASN1' encoding = B.concat . L.toChunks . encodeASN1 encoding