{"id":22302362,"url":"https://github.com/albertnieto/ssl_cert_generator","last_synced_at":"2025-09-22T21:51:49.525Z","repository":{"id":264588828,"uuid":"868969595","full_name":"albertnieto/ssl_cert_generator","owner":"albertnieto","description":"A Python-based tool for generating RSA private keys, creating Certificate Signing Requests (CSRs), and comparing public keys from private keys and CSRs.","archived":false,"fork":false,"pushed_at":"2024-11-25T07:38:48.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-30T21:14:54.007Z","etag":null,"topics":["cryptography","private-key","python3","rsa-cryptography"],"latest_commit_sha":null,"homepage":"","language":"Python","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/albertnieto.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}},"created_at":"2024-10-07T13:51:40.000Z","updated_at":"2024-12-24T06:17:28.000Z","dependencies_parsed_at":"2024-11-25T08:33:18.797Z","dependency_job_id":null,"html_url":"https://github.com/albertnieto/ssl_cert_generator","commit_stats":null,"previous_names":["albertnieto/ssl_cert_generator"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albertnieto%2Fssl_cert_generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albertnieto%2Fssl_cert_generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albertnieto%2Fssl_cert_generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albertnieto%2Fssl_cert_generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/albertnieto","download_url":"https://codeload.github.com/albertnieto/ssl_cert_generator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245563076,"owners_count":20635936,"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":["cryptography","private-key","python3","rsa-cryptography"],"created_at":"2024-12-03T18:36:43.449Z","updated_at":"2025-09-22T21:51:44.467Z","avatar_url":"https://github.com/albertnieto.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SSL Certificate Generator\n\nA Python-based tool for generating RSA private keys, creating Certificate Signing Requests (CSRs), and comparing public keys from private keys and CSRs. It leverages the `cryptography` library to simplify SSL certificate management.\n\n## Table of Contents\n\n- [Features](#features)\n- [Prerequisites](#prerequisites)\n- [Installation](#installation)\n- [Usage](#usage)\n  - [Generate Private Key and CSR](#generate-private-key-and-csr)\n  - [Compare Public Keys](#compare-public-keys)\n- [Examples](#examples)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Features\n\n- **Generate RSA Private Keys:** Supports key sizes of 2048, 3072, and 4096 bits.\n- **Create Certificate Signing Requests (CSRs):** Collects user input for CSR details.\n- **Generate Self-Signed Certificates:** Optionally create self-signed certificates.\n- **Compare Public Keys:** Extract and compare public keys from private keys and CSRs.\n\n## Prerequisites\n\n- **Python 3.6 or higher**\n- **pip** (Python package manager)\n\n## Installation\n\nInstall the `ssl_cert_generator` package from PyPI using `pip`:\n```bash\npip install ssl_cert_generator\n```\n\n## Usage\n\nThe `ssl_cert_generator` provides command-line interfaces to generate private keys, create CSRs, and compare public keys.\n\n### Generate Private Key and CSR\n\nUse the `generate_csr` command to generate an RSA private key and a CSR. You can optionally encrypt the private key with a passphrase and generate a self-signed certificate.\n\n**Basic Command:**\n```bash\ngenerate_csr\n```\n\n**Options:**\n\n- `--encrypt-key`: Encrypt the private key with a passphrase.\n- `--output-dir`: Specify the output directory for generated files. Defaults to `./data`.\n- `--self-signed`: Generate a self-signed certificate.\n\n**Example:**\n```bash\ngenerate_csr --encrypt-key --self-signed --output-dir ./certs\n```\n\n**Interactive Prompts:**\n\nYou'll be prompted to enter the following details:\n\n- Common Name (Hostname)\n- Organization\n- Organizational Unit\n- City / Locality\n- State / Region\n- Country (2-letter code)\n- Key Size (e.g., 2048, 3072, 4096)\n\nIf you choose to encrypt the private key, you'll be prompted to enter a passphrase.\n\n### Compare Public Keys\n\nUse the `compare_keys` command to extract and compare public keys from a private key and a CSR.\n\n**Basic Command:**\n```bash\ncompare_keys\n```\n\n**Options:**\n\n- `--key-file`: Path to the private key file. Defaults to `./data/private_key.pem`.\n- `--csr-file`: Path to the CSR file. Defaults to `./data/csr.pem`.\n- `--output-dir`: Output directory for public keys. Defaults to `./data`.\n- `--passphrase`: Passphrase for the encrypted private key, if applicable.\n\n**Example:**\n```bash\ncompare_keys --key-file ./certs/private_key.pem --csr-file ./certs/csr.pem --output-dir ./certs\n```\n\n\n**Output:**\n\nThe command will save the extracted public keys to the specified output directory and indicate whether the public keys match.\n\n## Examples\n\n### Example 1: Generate an Encrypted Private Key and CSR with Self-Signed Certificate\n```bash\ngenerate_csr --encrypt-key --self-signed --output-dir ./certs\n```\n\n**Sample Interaction:**\n```\nEnter the following details to generate CSR:\nCommon Name (Hostname): example.com\nOrganization: Example Corp\nOrganizational Unit: IT\nCity / Locality: New York\nState / Region: NY\nCountry (2-letter code): US\nKey Size (e.g., 2048, 3072, 4096): 2048\nEnter passphrase for private key encryption:\nPrivate key saved to ./certs/private_key.pem\nCSR saved to ./certs/csr.pem\nSelf-signed certificate saved to ./certs/self_signed_certificate.pem\n```\n\n### Example 2: Compare Public Keys from Private Key and CSR\n```bash\ncompare_keys --key-file ./certs/private_key.pem --csr-file ./certs/csr.pem --output-dir ./certs\n```\n\n**Sample Output:**\n```\nPublic Key from Private Key:\n-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArQwLcxdw0xjLcWek4Epl\n...\n-----END PUBLIC KEY-----\nPublic Key from CSR:\n-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArQwLcxdw0xjLcWek4Epl\n...\n-----END PUBLIC KEY-----\nThe public keys match!\n```\n\n*If the public keys do not match, the output will indicate accordingly.*\n\n## Contributing\n\nContributions are welcome! Please follow these steps:\n\n1. **Fork the Repository**\n\n2. **Create a Feature Branch**\n\n   ```bash\n   git checkout -b feature-name\n   ```\n\n3. **Commit Your Changes**\n\n   ```bash\n   git commit -m \"Add feature\"\n   ```\n\n4. **Push to the Branch**\n\n   ```bash\n   git push origin feature-name\n   ```\n\n5. **Open a Pull Request**\n\nProvide a clear description of the changes and any relevant context.\n\n## License\n\nThis project is licensed under the [Apache-2.0 license](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falbertnieto%2Fssl_cert_generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falbertnieto%2Fssl_cert_generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falbertnieto%2Fssl_cert_generator/lists"}