diff --git a/Data/PEM/Parser.hs b/Data/PEM/Parser.hs
--- a/Data/PEM/Parser.hs
+++ b/Data/PEM/Parser.hs
@@ -26,7 +26,9 @@
 
 import Data.PEM.Types
 
-parseOnePEM :: [L.ByteString] -> Either (Maybe String) (PEM, [L.ByteString])
+type Line = L.ByteString
+
+parseOnePEM :: [Line] -> Either (Maybe String) (PEM, [Line])
 parseOnePEM = findPem
   where beginMarker = "-----BEGIN "
         endMarker   = "-----END "
@@ -72,7 +74,7 @@
              in if x1 == prefix then Just x2 else Nothing
 
 -- | parser to get PEM sections
-pemParse :: [L.ByteString] -> [Either String PEM]
+pemParse :: [Line] -> [Either String PEM]
 pemParse l
     | null l    = []
     | otherwise = case parseOnePEM l of
@@ -86,6 +88,9 @@
 
 -- | parse a PEM content using a dynamic bytestring
 pemParseLBS :: L.ByteString -> Either String [PEM]
-pemParseLBS bs = case partitionEithers $ pemParse $ LC.lines bs of
+pemParseLBS bs = case partitionEithers $ pemParse $ map unCR $ LC.lines bs of
                     (x:_,_   ) -> Left x
                     ([] ,pems) -> Right pems
+  where unCR b | L.length b > 0 && L.last b == cr = L.init b
+               | otherwise                        = b
+        cr = fromIntegral $ fromEnum '\r'
diff --git a/pem.cabal b/pem.cabal
--- a/pem.cabal
+++ b/pem.cabal
@@ -1,5 +1,5 @@
 Name:                pem
-Version:             0.2.1
+Version:             0.2.2
 Description:         Privacy Enhanced Mail (PEM) format reader and writer.
 License:             BSD3
 License-file:        LICENSE
