A Python library to generate a signed email
Project description
python-smime-email
Generate x509 SMIME signed emails with ease!
Usage
-
Generate the email raw content
import smime_email data = b"Hello!" SMIME_KEY = smime_email.load_key("key_path.pem") SMIME_INTERMEDIATE = smime_email.load_certificates("intermediate_path.pem") SMIME_CERT = smime_email.load_certificates("cert_path.pem")[0] email_raw_bytes = smime_email.get_smime_attachment_content(data, SMIME_KEY, SMIME_INTERMEDIATE, SMIME_CERT)
-
Send it using any email library you like. Here is an example as Django email backend
email_raw_bytes = smime_email.get_smime_attachment_content(data, SMIME_KEY, SMIME_INTERMEDIATE, SMIME_CERT) # ... class EmailBackend(BaseEmailBackend): def send_messages(self, message) -> int: with smtplib.SMTP(settings.EMAIL_HOST, settings.EMAIL_PORT) as server: server.sendmail(message.from_email, message.to, email_raw_bytes) return 1
Development
The code is formatted with ruff and checked with various linters.
To run the whole linting and formatting process, run poetry run poe all
.
License
Code and documentation copyright 2024 Siemens AG.
See LICENSE.md.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file smime_email-1.0.1.tar.gz
.
File metadata
- Download URL: smime_email-1.0.1.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
26e54546f92cde2350fb6d1c3a7b321e039590c86f1ab3df27ac43e058965ba3
|
|
MD5 |
ae833cf6295e7c0657cf8e08412ffa12
|
|
BLAKE2b-256 |
4f2fd01148bf8464e9eef4802ac60a1483346b231e9814c70f8049da2b696b35
|
Provenance
The following attestation bundles were made for smime_email-1.0.1.tar.gz
:
Publisher:
publish.yml
on siemens/python-smime-email
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1
-
Predicate type:
https://docs.pypi.org/attestations/publish/v1
-
Subject name:
smime_email-1.0.1.tar.gz
-
Subject digest:
26e54546f92cde2350fb6d1c3a7b321e039590c86f1ab3df27ac43e058965ba3
- Sigstore transparency entry: 201527747
- Sigstore integration time:
-
Permalink:
siemens/python-smime-email@6509bc88d3c52d9c5e922a0956f366db47c50464
-
Branch / Tag:
refs/tags/v1.0.1
- Owner: https://github.com/siemens
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com
-
Runner Environment:
github-hosted
-
Publication workflow:
publish.yml@6509bc88d3c52d9c5e922a0956f366db47c50464
-
Trigger Event:
push
-
Statement type:
File details
Details for the file smime_email-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: smime_email-1.0.1-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
9e9588489e077c9466c7a9ea95d40c1cb1ba9b74ee8240a49a61d68320f77da5
|
|
MD5 |
31eea410ae8499fd882f47e188da1e2b
|
|
BLAKE2b-256 |
55966e2befb0d9c28f727556a32808a16a1704f83095e5b0a79c8e3599a17c23
|
Provenance
The following attestation bundles were made for smime_email-1.0.1-py3-none-any.whl
:
Publisher:
publish.yml
on siemens/python-smime-email
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1
-
Predicate type:
https://docs.pypi.org/attestations/publish/v1
-
Subject name:
smime_email-1.0.1-py3-none-any.whl
-
Subject digest:
9e9588489e077c9466c7a9ea95d40c1cb1ba9b74ee8240a49a61d68320f77da5
- Sigstore transparency entry: 201527749
- Sigstore integration time:
-
Permalink:
siemens/python-smime-email@6509bc88d3c52d9c5e922a0956f366db47c50464
-
Branch / Tag:
refs/tags/v1.0.1
- Owner: https://github.com/siemens
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com
-
Runner Environment:
github-hosted
-
Publication workflow:
publish.yml@6509bc88d3c52d9c5e922a0956f366db47c50464
-
Trigger Event:
push
-
Statement type: