{"id":26509630,"url":"https://github.com/mercurytechnologies/tls-sslkeylogfile","last_synced_at":"2026-02-17T07:33:51.234Z","repository":{"id":282438127,"uuid":"944222445","full_name":"MercuryTechnologies/tls-sslkeylogfile","owner":"MercuryTechnologies","description":"`SSLKEYLOGFILE`-based TLS session key extraction for Haskell","archived":false,"fork":false,"pushed_at":"2025-03-14T17:00:52.000Z","size":23,"stargazers_count":0,"open_issues_count":2,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-09-04T06:52:01.370Z","etag":null,"topics":["haskell","tls"],"latest_commit_sha":null,"homepage":"","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MercuryTechnologies.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSES/BSD-3-Clause.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-03-07T01:37:28.000Z","updated_at":"2025-03-14T17:00:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"048012bc-8550-4499-934c-67d6bd1e6f4a","html_url":"https://github.com/MercuryTechnologies/tls-sslkeylogfile","commit_stats":null,"previous_names":["mercurytechnologies/tls-sslkeylogfile"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/MercuryTechnologies/tls-sslkeylogfile","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MercuryTechnologies%2Ftls-sslkeylogfile","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MercuryTechnologies%2Ftls-sslkeylogfile/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MercuryTechnologies%2Ftls-sslkeylogfile/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MercuryTechnologies%2Ftls-sslkeylogfile/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MercuryTechnologies","download_url":"https://codeload.github.com/MercuryTechnologies/tls-sslkeylogfile/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MercuryTechnologies%2Ftls-sslkeylogfile/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274026706,"owners_count":25209739,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-07T02:00:09.463Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["haskell","tls"],"created_at":"2025-03-21T01:19:54.985Z","updated_at":"2026-02-17T07:33:51.178Z","avatar_url":"https://github.com/MercuryTechnologies.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!--\nSPDX-FileCopyrightText: 2025 Mercury Technologies, Inc\n\nSPDX-License-Identifier: MIT\n--\u003e\n\n# tls-sslkeylogfile\n\nThis package adds support for the [`SSLKEYLOGFILE` standard](https://www.ietf.org/archive/id/draft-thomson-tls-keylogfile-00.html) to Haskell programs using the `tls` and/or `http-client` libraries.\n\nThis packages uses the functionality built into the Haskell `tls` library to extract the *session keys* of TLS sessions and store them in the `SSLKEYLOGFILE` format.\nIn TLS, the session keys are ephemeral *symmetric* keys used to encrypt just the data for each session.\nThey are generated and exchanged during the TLS handshake, and with modern TLS cipher suites with [Perfect Forward Secrecy], are handled via completely separate machinery (Diffie-Hellman) from the server's private key, the latter only being used to sign the handshake.\nAs far as key material is concerned, session keys are not very sensitive: they are generated for every session and grabbing them for debugging only allows access to the traffic for which the keys are known.\n\n[Perfect Forward Secrecy]: https://en.wikipedia.org/wiki/Forward_secrecy\n\nUsing session keys allows for (relatively) easy debugging of HTTPS traffic using commonly-available packet sniffers like Wireshark *without altering the traffic at all*, and without wider security impacts like e.g. adding local TLS certification authorities to the system keyring.\n\nFor more details on TLS interception using session keys, see: \u003chttps://jade.fyi/blog/announcing-clipper/\u003e.\n\n## Related work\n\n- [mitmproxy](https://mitmproxy.org/) - an intercepting TLS proxy with a lot of features.\n\n  It can operate as a proxy with fake certificates in various modes including capturing raw traffic and tampering with it, acting as a traditional HTTPS proxy, and more.\n  It's really cool.\n\n  However, the fake certificates mode can be unfortunate since they require certificate configuration in the application and are not transparent: you can't use mitmproxy to debug TLS implementation bugs, for instance, since it changes the traffic to intercept it.\n- [clipper](https://github.com/lf-/clipper) - a fully integrated TLS session-key-log based packet sniffer for Linux by the same author as this package.\n\n  Clipper does the same thing as this package for rustls and OpenSSL with no application-level changes, implemented by injecting code into the process.\n  It captures traffic transparently and can either generate pcapng files with included keys or decode traffic on-the-fly to display it in Chrome DevTools.\n\n  However, it does not support either extracting keys from Haskell or capturing traffic on macOS.\n\n## Usage\n\nSet up tls-sslkeylogfile on a simple program (see [examples/demo/Demo.hs](./examples/demo/Demo.hs)):\n\n```haskell\nimport Network.TLS.SSLKeyLogFile\nimport Network.HTTP.Client (parseRequest, httpLbs, Response (..))\n\nmain :: IO ()\nmain = do\n  man \u003c- makeManager\n\n  req \u003c- parseRequest \"https://example.com/index.html\"\n  resp \u003c- httpLbs req man\n  putStrLn $ \"The status code was: \" ++ show (responseStatus resp)\n```\n\nThen run it with some interception:\n\nIn one terminal, capture some packets (tcpdump can equally be used):\n\n```\n$ tshark -w pakits.pcapng -i en9 'port 443'\nCapturing on 'REDACTED: en9'\n322 ^C\n```\n\nIn another, run the program with `SSLKEYLOGFILE` set:\n\n```\n$ SSLKEYLOGFILE=keys.log cabal run keylogfile-demo\nThe status code was: Status {statusCode = 200, statusMessage = \"OK\"}\n```\n\nAfter the debugee finishes, the `tshark` command should be CTRL-C'd.\n\n`keys.log` will look like the following:\n\n```\nSERVER_HANDSHAKE_TRAFFIC_SECRET aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\nCLIENT_HANDSHAKE_TRAFFIC_SECRET aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\nSERVER_TRAFFIC_SECRET_0 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd\nCLIENT_TRAFFIC_SECRET_0 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\n```\n\nThe actual keys are replaced with placeholders here for readability.\nThis is a TLS 1.3 session because there are lines that are not tagged `CLIENT_RANDOM`.\n\nPut the keys into the pcapng so the analysis tools work nicely:\n\n```\n$ editcap --inject-secrets tls,keys.log pakits.pcapng pakits2.pcapng\n```\n\nThen, look at the packets with tshark:\n\n```\n$ tshark -r pakits2.pcapng -T fields -e '_ws.col.Info' --display-filter http\nGET /index.html HTTP/1.1\nHTTP/1.1 200 OK  (text/html)\n```\n\nHere's our traffic! If you wanted a nicer UX of looking at it, just open the pcapng file in Wireshark, the encrypted traffic will be right there decrypted for you.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmercurytechnologies%2Ftls-sslkeylogfile","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmercurytechnologies%2Ftls-sslkeylogfile","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmercurytechnologies%2Ftls-sslkeylogfile/lists"}