haskell-tls / hs-certificate

Certificate and Key Reader/Writer in haskell
60 stars 57 forks source link

*** Exception: TypeDecodingFailed "time format invalid for TimeUTC : cannot convert string 0007181000Z" #45

Closed habbler closed 8 years ago

habbler commented 9 years ago

Hello, On a windows 7 machine executing getSystemCertificateStore Results in *\ Exception: TypeDecodingFailed "time format invalid for TimeUTC : cannot convert string 0007181000Z"

How do I find out which certificate is causing this problem? Would it be possible for you to catch such exceptions and give out a better error message?

Rene.

vincenthz commented 9 years ago

I'm not sure why this happens; the code should already be filtering out certificate that cannot be decoded, not raise an exception.

habbler commented 9 years ago

To get around this I patched module System.X509.Win32

in getSystemCertificateStore

                case ecert of
                    Left _     -> loop st r
                    Right cert -> (cert :) <$> (loop st r)
                `catch` \(_ :: ASN1Error)-> loop st r

Better than just dying. Ignores all certificates that have an ANS1Error

vincenthz commented 8 years ago

I fixed the underlaying issue in asn1 and added the catch in the win32 code, so that should be fixed now