{"id":29047937,"url":"https://github.com/oluizeduardo/mutual-tls-java-demo","last_synced_at":"2025-06-26T17:34:40.935Z","repository":{"id":296613865,"uuid":"993900166","full_name":"oluizeduardo/mutual-tls-java-demo","owner":"oluizeduardo","description":"Example project demonstrating digital certificate generation and mutual TLS authentication using Java and OpenSSL.","archived":false,"fork":false,"pushed_at":"2025-05-31T22:45:10.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-01T09:31:00.958Z","etag":null,"topics":["java","mtls","mtls-authentication","openssl"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oluizeduardo.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2025-05-31T19:04:13.000Z","updated_at":"2025-05-31T22:45:13.000Z","dependencies_parsed_at":"2025-06-01T09:31:04.932Z","dependency_job_id":"bfa4ffd3-1a7d-4156-a5d8-a9c3ea4565ef","html_url":"https://github.com/oluizeduardo/mutual-tls-java-demo","commit_stats":null,"previous_names":["oluizeduardo/mutual-tls-java-demo"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/oluizeduardo/mutual-tls-java-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oluizeduardo%2Fmutual-tls-java-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oluizeduardo%2Fmutual-tls-java-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oluizeduardo%2Fmutual-tls-java-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oluizeduardo%2Fmutual-tls-java-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oluizeduardo","download_url":"https://codeload.github.com/oluizeduardo/mutual-tls-java-demo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oluizeduardo%2Fmutual-tls-java-demo/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262113772,"owners_count":23261099,"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","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":["java","mtls","mtls-authentication","openssl"],"created_at":"2025-06-26T17:34:38.392Z","updated_at":"2025-06-26T17:34:40.927Z","avatar_url":"https://github.com/oluizeduardo.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mutual TLS (mTLS) Demo in Java\n\nThis project is a simple demonstration of **Mutual TLS (mTLS)** authentication using Java and OpenSSL-generated certificates in **PKCS12** format.\n\nIt includes:\n- A Bash script (`setup-mtls.sh`) to generate certificates.\n- A Java HTTPS server (`MutualTLSServer.java`) that requires clients to present valid certificates.\n- A Java HTTPS client (`MutualTLSClient.java`) that authenticates itself and trusts only a known server.\n\n## 📘 What is Mutual TLS?\n\n**Mutual TLS** is an extension of standard TLS (*Transport Layer Security*) where **both** the server and the client authenticate each other using certificates.\n\n- In normal TLS (e.g., HTTPS), the client verifies the server's identity via its certificate.\n- In **mutual** TLS, the server also requires the client to present a trusted certificate, creating a **two-way trust**.\n\nThis is commonly used in:\n- Secure microservice communication\n- APIs requiring strong client identity\n- Enterprise VPNs\n\n## 🔧 How to Use This Project\n\n### 1. Clone the Repository\n\n```bash\ngit clone https://github.com/your-username/mutual-tls-java-demo.git\ncd mutual-tls-java-demo\n```\n\n### 2. Generate Certificates\n\nMake sure you have OpenSSL installed, then run:\n\n```bash\n./setup-mtls.sh\n```\n\nThis will generate:\n- A Certificate Authority (CA)\n- A server certificate signed by the CA\n- A client certificate signed by the CA\n- PKCS12 keystores: `server.p12`, `client.p12`\n\n### 3. Compile the Java Classes\n\nEnsure you’re using Java 11 or later (for TLS 1.3 compatibility).\n\n```bash\njavac MutualTLSServer.java\njavac MutualTLSClient.java\n```\n\n### 4. Run the Server\n\n```bash\njava MutualTLSServer\n```\n\nYou should see:\n\n```bash\nHTTPS server with mTLS started on port 8443\n```\n\n### 5. Run the Client\n\nOpen a second terminal and run:\n\n```bash\njava MutualTLSClient\n```\n\nExpected output:\n\n```bash\nServer response: Hello, authenticated client!\n```\n\n## 🔒 Requirements\n- Java 11+\n- OpenSSL (for generating certificates)\n- Bash shell\n\n## ✅ Security Notes\n\n- This setup is for local development and educational purposes.\n- In production, certificates should have stronger protection, revocation support, and expiry handling.\n- Passwords like `changeit` should never be used in real deployments.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foluizeduardo%2Fmutual-tls-java-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foluizeduardo%2Fmutual-tls-java-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foluizeduardo%2Fmutual-tls-java-demo/lists"}