Skip to main content
https://img.shields.io/pypi/v/poor-smime-sign.svg https://img.shields.io/travis/seporaitis/poor-smime-sign.svg

A very poor tool to generate S/MIME signatures for arbitrary content & probably insecurely too.

A quick example:

>>> smime_sign(
...     signer_cert_path="/path/to/files/signer.cert",
...     signer_key_path="/path/to/files/signer.pem",
...     recipient_cert_path="/path/to/files/recipient.cert",
...     content="test",
...     output_format="PEM",
... )

Features

  • Does S/MIME signatures.

  • Verifies S/MIME signatures.

Why?

This utility library has single purpose - provide support for making S/MIME signatures on Python2 and 3, which currently lacks any proper libraries for that purpose.

The main use case it is built for: at work our system has to generate Apple Passbook Pass files, which include an S/MIME signature. Currently it is done using M2Crypto.SMIME. While that works - we want to migrate to Python3, and unfortunately for us M2Crypto is not fully supported. smime_sign is a poor man’s solution for this problem.

Internally this does nothing more than call openssl smime, so you might want to see its docs too.

Why not?

  • This may be insecure.

  • This may be slow if you are signing large blobs of text.

API

smime_sign(signer_cert_path, signer_key_path, cert_path, recipient_cert_path, content, output_format)

Generates and returns signature string for content in output_format.

All *_path arguments must be absolute paths.

content must be a string, not a path.

Example to generate signature for Passbook manifest:

>>> manifest_json = "..."  # JSON string with `manifest.json` content
>>> signature = smime_sign(
...     signer_cert_path="/path/to/files/signer.cert",
...     signer_key_path="/path/to/files/signer.pem",
...     cert_path="/path/to/files/intermediate.cert",
...     recipient_cert_path=None,
...     content=manifest_json,
...     output_format="DER",
... )

smime_verify(signer_cert_path, content_path, signature_path, signature_format)

Verifies a content_path file against a signature at signature_path.

Note: this function was added to help in the tests only.

Credits

Tools used in rendering this package:

History

2.0.3 (2016-09-13)

  • Change the licence from AGPLv3 to MIT.

2.0.2 (2016-01-07)

  • Fix documentation rendering on PyPI

2.0.1 (2016-01-07)

  • Added support for passing intermediate certificates.

  • Made recipient certificate optional.

  • Argument structure for smime_sign has changed, therefore major version bump-up.

1.0.0 (2015-11-27)

  • First release on PyPI.

Metadata

Release files for poor-smime-sign 2.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for poor-smime-sign 2.0.3
File Size Uploaded
poor-smime-sign-2.0.3.tar.gz 13.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for poor-smime-sign 2.0.3
File Interpreter ABI Platform
poor_smime_sign-2.0.3-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 19.6 kB

Release files / poor-smime-sign-2.0.3.tar.gz

Download URL poor-smime-sign-2.0.3.tar.gz
Size 13.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f5264f1e7e97929ef54f91357814acab831cde3dff34e822b583b2fc9bb37dc9
BLAKE2b-256 checksum
How to use checksums
4ac6798c10fa46dc4d01fc5cbc139a67b353683f9e5e211b48b4dd2eec7dd4a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / poor_smime_sign-2.0.3-py2.py3-none-any.whl

Download URL poor_smime_sign-2.0.3-py2.py3-none-any.whl
Size 6.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
b3a560130855da804f70330978c3ecfe273f11d9a7cd0f22ec6fc4cfd62aacb0
BLAKE2b-256 checksum
How to use checksums
e68c0279b57b6f2b7c4103cb21c2799b90dc3644393fca6f1fb5f94361432254
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

2.0.3 This release

2 release files

2.0.2

1 release file

2.0.1

1 release file

2.0.0

1 release file

1.0.1

1 release file

1.0.0

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page