{"id":46384650,"url":"https://github.com/haskell-cryptography/boringssl-hs","last_synced_at":"2026-03-05T07:09:16.806Z","repository":{"id":337388931,"uuid":"1153330779","full_name":"haskell-cryptography/boringssl-hs","owner":"haskell-cryptography","description":"Bindings to BoringSSL in Haskell","archived":false,"fork":false,"pushed_at":"2026-02-28T17:27:20.000Z","size":607,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"dev","last_synced_at":"2026-02-28T19:58:22.273Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/haskell-cryptography.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-09T07:08:35.000Z","updated_at":"2026-02-28T17:27:23.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/haskell-cryptography/boringssl-hs","commit_stats":null,"previous_names":["samuelschlesinger/boringssl-hs","haskell-cryptography/boringssl-hs"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/haskell-cryptography/boringssl-hs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haskell-cryptography%2Fboringssl-hs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haskell-cryptography%2Fboringssl-hs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haskell-cryptography%2Fboringssl-hs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haskell-cryptography%2Fboringssl-hs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/haskell-cryptography","download_url":"https://codeload.github.com/haskell-cryptography/boringssl-hs/tar.gz/refs/heads/dev","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haskell-cryptography%2Fboringssl-hs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30113223,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T03:40:26.266Z","status":"ssl_error","status_checked_at":"2026-03-05T03:39:15.902Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2026-03-05T07:09:15.783Z","updated_at":"2026-03-05T07:09:16.788Z","avatar_url":"https://github.com/haskell-cryptography.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# boringssl\n\n[![CI](https://github.com/haskell-cryptography/boringssl-hs/actions/workflows/ci.yml/badge.svg)](https://github.com/haskell-cryptography/boringssl-hs/actions/workflows/ci.yml)\n\nIdiomatic Haskell bindings to Google's [BoringSSL](https://boringssl.googlesource.com/boringssl/) cryptography library.\n\n\u003e **Warning:** This library is experimental and under active construction. The API\n\u003e is unstable and may change without notice. Do not use this in production systems.\n\n## Overview\n\nThis library provides idiomatic Haskell bindings to BoringSSL's cryptographic\nprimitives via the FFI. BoringSSL is Google's maintained fork of OpenSSL,\nbattle-tested across Chrome, Android, and Google's infrastructure. These\nbindings give Haskell programs access to the same well-audited cryptographic\nimplementations, wrapped in an API that feels natural in Haskell: pure\ninterfaces where possible, `ByteString`-based data types throughout, and proper\nmemory management via `ForeignPtr` finalizers.\n\n## Supported GHC versions\n\n| GHC     | Linux | macOS | Windows |\n|---------|-------|-------|---------|\n| 9.6.x   | Yes   | Yes   | Yes     |\n| 9.8.x   | Yes   | Yes   | —       |\n| 9.10.x  | Yes   | Yes   | —       |\n\n## Features\n\n**Hash functions** — SHA-1, SHA-2 (224/256/384/512/512-256), MD5, BLAKE2b-256.\nOne-shot and streaming APIs.\n\n**MACs** — HMAC (all hash algorithms), CMAC (AES-128/256), SipHash.\n\n**Key derivation** — HKDF, PBKDF2, scrypt, TLS PRF.\n\n**Authenticated encryption (AEAD)** — AES-GCM (128/192/256),\nChaCha20-Poly1305, XChaCha20-Poly1305, AES-GCM-SIV, AES-CTR-HMAC-SHA256,\nAES-EAX, AES-CCM.\n\n**Symmetric ciphers** — AES-128/256 in CBC, CTR, ECB, and OFB modes.\n\n**Asymmetric cryptography** — Ed25519, X25519, ECDSA (P-256/P-384/P-521),\nECDH, RSA (sign/verify/encrypt with PSS, PKCS#1 v1.5, and OAEP).\n\n**Post-quantum** — ML-KEM (Kyber), ML-DSA (Dilithium), SLH-DSA (SPHINCS+),\nX-Wing (X25519 + ML-KEM-768 hybrid).\n\n**Protocols** — HPKE (RFC 9180), SPAKE2, TrustToken.\n\n**Encoding \u0026 PKI** — Base64, PEM, X.509 parsing, private key\nserialization.\n\n## Quick start\n\n```haskell\nimport Crypto.BoringSSL.AEAD\nimport Crypto.BoringSSL.Digest\nimport Crypto.BoringSSL.Random (getRandomBytes)\n\n-- Hash some data\nlet digest = hashSHA256 \"hello, world\"\n\n-- Authenticated encryption with AES-256-GCM\nmain :: IO ()\nmain = do\n  key \u003c- getRandomBytes 32\n  case newAEADCtx AES256GCM key of\n    Left err -\u003e error (show err)\n    Right ctx -\u003e do\n      nonce \u003c- generateNonce ctx\n      let ad         = \"\"  -- associated data\n          ciphertext = seal ctx nonce ad \"secret message\"\n      case open ctx nonce ad ciphertext of\n        Left err        -\u003e error (show err)\n        Right plaintext -\u003e print plaintext  -- \"secret message\"\n```\n\n## Building\n\nThe library compiles BoringSSL from source (included as a Git submodule under\n`third_party/boringssl`), so no system-level BoringSSL installation is required.\nYou will need a C++17 compiler (`g++` or `clang++`).\n\n```\ngit clone --recurse-submodules https://github.com/haskell-cryptography/boringssl-hs.git\ncd boringssl-hs\ncabal build\n```\n\nTo run the test suite:\n\n```\ncabal test\n```\n\n### Assembly optimizations\n\nBy default, BoringSSL is compiled with portable C fallback implementations.\nOn x86\\_64 and aarch64 (Linux and macOS), you can enable hand-written assembly\noptimizations for improved performance and stronger constant-time guarantees:\n\n```\ncabal build -fasm\n```\n\nThe `-fasm` flag enables optimized routines for AES, SHA, ChaCha20, Poly1305,\nP-256, and Montgomery multiplication. On unsupported platforms, the flag is\nsilently ignored.\n\n### Platform notes\n\n- **Linux**: Requires `g++` (or `clang++`) and `libstdc++`. Tested on x86\\_64\n  and aarch64.\n- **macOS**: Requires `clang++` (Xcode command-line tools). Tested on Apple\n  Silicon and Intel.\n- **Windows**: Requires MinGW `g++`. Assembly optimizations are not available.\n\n## Security considerations\n\n- **Nonce management**: AES-GCM nonce reuse is catastrophic — it completely\n  destroys both confidentiality and authenticity. Use `generateNonce` for\n  random nonces, or use AES-GCM-SIV for nonce-misuse resistance.\n- **Constant-time operations**: BoringSSL provides constant-time\n  implementations for sensitive operations. Enabling `-fasm` provides stronger\n  constant-time guarantees via hand-written assembly.\n- **Secure memory**: Private key material can be stored in `SecureBytes`, which\n  is allocated outside the GC heap and zeroed on deallocation.\n- **Unauthenticated ciphers**: The `Cipher` module (AES-CBC, CTR, ECB, OFB)\n  does **not** provide integrity protection. Prefer AEAD ciphers for\n  encryption.\n- **PKCS#1 v1.5 encryption**: The RSA PKCS#1 v1.5 encryption functions are\n  deprecated due to Bleichenbacher-style attacks. Use OAEP instead.\n\n## Governance\n\nThis project is part of the [haskell-cryptography](https://github.com/haskell-cryptography)\norganization. See [STRUCTURE.md](https://github.com/haskell-cryptography/governance/blob/main/STRUCTURE.md)\nfor governance details.\n\n## Disclaimer\n\nThis is not an officially supported Google product.\n\n## Current status\n\nThis library is a work in progress. The cryptographic primitives listed above\nare implemented and tested, but you should expect breaking API changes as the\nlibrary matures. Contributions and feedback are welcome.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaskell-cryptography%2Fboringssl-hs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhaskell-cryptography%2Fboringssl-hs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaskell-cryptography%2Fboringssl-hs/lists"}