Search code examples
haskellsslhttpswarp

warp-tls errors with HandshakeFailed (Error_Misc "no keys found)


I'm trying to setup https on my website. I'm using a servant exec on a google cloud vm instance (ubuntu). This is my code:

startApp :: FilePath ->  IO ()
startApp dbFile = do
     let tls = tlsSettings "ssl/22cb488c23a886e2.crt" "ssl/generated-private-key.pem"
     runTLS tls (setPort 443 defaultSettings) $ app dbFile

When I run my exec (it's in the same dir as the ssl dir) I get the following:

HandshakeFailed (Error_Misc "no keys found\nCallStack (from HasCallStack):\n  error, called at ./Network/Wai/Handler/W
arpTLS.hs:265:20 in warp-tls-3.2.5-2FsWeMf1nNvA0nztofVYMj:Network.Wai.Handler.WarpTLS")

I have tried setting the file permissions of my .crt and .pem file with chmod 777 with no success.


Solution

  • So it turned out to be my private key format. GoDaddy gave me the incorrect private key format. I needed to generate an RSA 2048-bit key.