asn1-data 0.6.0 → 0.6.1
raw patch · 4 files changed
+13/−10 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Data/ASN1/BER.hs +1/−1
- Data/ASN1/DER.hs +1/−1
- Data/ASN1/Prim.hs +10/−7
- asn1-data.cabal +1/−1
Data/ASN1/BER.hs view
@@ -195,7 +195,7 @@ {- helper to transform a Someexception from the enumerator to an ASN1Err if possible -} wrapASN1Err :: Either SomeException a -> Either ASN1Err a-wrapASN1Err (Left err) = Left (maybe (ASN1ParsingFail "unknown") id $ fromException err)+wrapASN1Err (Left err) = Left (maybe (ASN1ParsingFail $ show err) id $ fromException err) wrapASN1Err (Right x) = Right x {-| decode a list of raw ASN1Events into a stream of ASN1 types -}
Data/ASN1/DER.hs view
@@ -137,7 +137,7 @@ {- helper to transform a Someexception from the enumerator to an ASN1Err if possible -} wrapASN1Err :: Either SomeException a -> Either ASN1Err a-wrapASN1Err (Left err) = Left (maybe (ASN1ParsingFail "unknown") id $ fromException err)+wrapASN1Err (Left err) = Left (maybe (ASN1ParsingFail $ show err) id $ fromException err) wrapASN1Err (Right x) = Right x {-| decode a list of raw ASN1Events into a stream of ASN1 types -}
Data/ASN1/Prim.hs view
@@ -74,15 +74,18 @@ L.pack $ concatMap (\c -> let (d,m) = (fromEnum c) `divMod` 256 in [fromIntegral m,fromIntegral d] ) $ T.unpack t decodeUCS2BE :: L.ByteString -> Text-decodeUCS2BE l = T.pack $ loop l+decodeUCS2BE lbs = T.pack $ loop lbs where- loop x- | L.null x = []+ loop bs+ | L.null bs = [] | otherwise = - let (h, r) = L.splitAt 2 l in- case L.unpack h of- [a,b] -> (toEnum $ (fromIntegral a) + (fromIntegral b) * 256) : loop r- _ -> loop r+ let (h, r) = L.splitAt 2 bs in+ case L.length h of+ 2 -> (toEnum $ fromIntegral $ be16 h) : loop r+ _ -> loop r+ be16 :: L.ByteString -> Word16+ be16 b = fromIntegral (L.index b 0) `shiftL` 8+ + fromIntegral (L.index b 1) encodeHeader :: Bool -> ASN1Length -> ASN1 -> ASN1Header
asn1-data.cabal view
@@ -1,5 +1,5 @@ Name: asn1-data-Version: 0.6.0+Version: 0.6.1 Description: ASN1 data reader and writer in raw form with supports for high level forms of ASN1 (BER, CER and DER). .