{"id":27650688,"url":"https://github.com/nerdocs/amelis-smime-decrypt","last_synced_at":"2025-06-12T00:33:35.953Z","repository":{"id":275490188,"uuid":"924884070","full_name":"nerdocs/amelis-smime-decrypt","owner":"nerdocs","description":"AMELIS laboratory client for SMIME encrypted emails","archived":false,"fork":false,"pushed_at":"2025-02-02T23:35:46.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-24T03:45:28.103Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","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/nerdocs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-01-30T20:20:08.000Z","updated_at":"2025-02-02T23:35:49.000Z","dependencies_parsed_at":"2025-02-02T22:17:57.049Z","dependency_job_id":"4c9efc64-eff1-46e4-bcf9-d3f2144989f2","html_url":"https://github.com/nerdocs/amelis-smime-decrypt","commit_stats":null,"previous_names":["nerdocs/amelis-smime-decrypt"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nerdocs/amelis-smime-decrypt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nerdocs%2Famelis-smime-decrypt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nerdocs%2Famelis-smime-decrypt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nerdocs%2Famelis-smime-decrypt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nerdocs%2Famelis-smime-decrypt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nerdocs","download_url":"https://codeload.github.com/nerdocs/amelis-smime-decrypt/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nerdocs%2Famelis-smime-decrypt/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259370458,"owners_count":22847298,"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":[],"created_at":"2025-04-24T03:45:27.142Z","updated_at":"2025-06-12T00:33:35.928Z","avatar_url":"https://github.com/nerdocs.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 📧 amelis-smime-decrypt\n\n`amelis-smime-decrypt` is a Python script that connects to an IMAP email mailbox, fetches unread S/MIME encrypted emails, decrypts them using a provided private key, and extracts PDF attachments.\n\n## 🚀 Features\n\n✔️ Connects to an IMAP email server\u003cbr\u003e\n✔️ Fetches emails with given text in Subject\u003cbr\u003e\n✔️ Detects and decrypts S/MIME encrypted emails\u003cbr\u003e\n✔️ Extracts PDF attachments and saves them\u003cbr\u003e (TODO)\n✔️ Secure handling of private keys \u0026 credentials\u003cbr\u003e\n\n## 📦 Installation for usage\n\nEasy.\n\nTODO: This is still necessary to be done.\n```bash\npip install amelis-smime-decrypt\n```\n\n## 📦 Installation for development\n\n### Install prerequisites\n```bash\n# install dependencies for building M2Crypto\nsudo apt-get install libssl-dev swig python3-dev gcc python3-virtualenv\n```\n\n###  Clone the repository\n\ngit clone https://github.com/nerdocs/amelis-smime-decrypt.git\ncd amelis-smime-decrypt\n\n### Create a virtualenv\n\n```bash\nvirtualenv .venv\n. .venv/bin/activate\n```\n\n### Install package and dependencies\n\nEnsure you have Python 3.8+, then run:\n\n```bash\npip install -e .\n```\n\n## 🔑 Configuration\n\n### Update Email Credentials\n\nCreate an `.env` file (copy the existing `.env.example`).\nEdit the SAVE_DIRECTORY, IMAP_SERVER, EMAIL_ACCOUNT, and EMAIL_PASSWORD inside .env:\n\nIMAP_SERVER = \"imap.example.com\"\nEMAIL_ACCOUNT = \"your_email@example.com\"\nEMAIL_PASSWORD = \"your_password\"\n\n\n### S/MIME Decryption Keys\n\nStore your private key and certificate in a secure location:\n\n    .../private_key.pem\n    .../certificate.pem\n\nChances are big that your certificate comes encrypted with the more or less deprecated RC2-40-CBC algorithm as `youremail@example.com.p12` file. If this is the case, convert it to a private key and certificate file using:\n\n```bash\nMAIL=youremail@example.com\nopenssl pkcs12 -in ${MAIL}.p12 -out ${MAIL}.crt.pem -clcerts -nokeys -legacy\nopenssl pkcs12 -in ${MAIL}.p12 -out ${MAIL}.key.pem -nocerts -nodes -legacy\n```\nYou might need to provide the import password for the certificate.\n\nUpdate PRIVATE_KEY_PATH and CERTIFICATE_PATH in the `.env` file to point to those files.\n\n## 🛠️ Usage\n\nRun the script:\n\n```bash\npython amelis-smime-decrypt.py\n```\n\nThe script will:\n\n    Connect to the given email inbox.\n    Fetch unread emails.\n    If encrypted, decrypt them using S/MIME.\n    Extract PDF attachments and save them to the given attachments folder.\n\n### 📂 Output\n\nAll extracted PDFs are saved in the directory you specify in `SAVE_DIRECTORY`.\n\nattachments/\n ├── invoice_123.pdf\n ├── report.pdf\n\n### Security Considerations\n\n    Protect your private key: Do not share private_key.pem.\n    Use environment variables for credentials.\n    Limit IMAP access to trusted networks.\n\n## 📝 License\n\nThis project is licensed under the GPL v3.0 License or later.\n\n## 🤝 Contributing\n\nPull requests are welcome! Feel free to fork and submit PRs.\n\n## 📧 Support\n\nFor issues, please open a [GitHub Issue](https://github.com/nerdocs/amelis-smime-decrypt/issues).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnerdocs%2Famelis-smime-decrypt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnerdocs%2Famelis-smime-decrypt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnerdocs%2Famelis-smime-decrypt/lists"}