haskell-tls / hs-certificate

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

Make MacOS certificates store fetching safer #128

Open Martoon-00 opened 2 years ago

Martoon-00 commented 2 years ago

We tended to get the following error on MacOS systems once terminating our server app:

Error in runWeb3: invalid PEM: decoding failed: base64: input: invalid length
CallStack (from HasCallStack):
  error, called at ./System/X509/MacOS.hs:23:20 in x509-system-1.6.6-5ZyNxglFGW64UWoaGFlfPb:System.X509.MacOS 

This PR fixes that, see the commit description for details.

Probably the code style is not very neat now, I'm open to any suggestions here. Also, I tried to stick to the error usage as it was before, but maybe adding a dedicated catchable exception type would be better.