pem


Namepem JSON
Version 23.1.0 PyPI version JSON
download
home_page
SummaryPEM file parsing in Python.
upload_time2023-06-21 10:24:40
maintainer
docs_urlNone
author
requires_python>=3.8
license
keywords cryptography pem pyopenssl ssl tls twisted
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pem: PEM file parsing for Python


*pem* is a Python module for parsing and splitting of [PEM files](https://en.wikipedia.org/wiki/X.509#Certificate_filename_extensions), i.e. Base64-encoded DER keys and certificates.

It has no dependencies and does not attempt to interpret the certificate data in any way.

It’s born from the need to load keys, certificates, trust chains, and Diffie–Hellman parameters from various certificate deployments:
some servers (like [Apache](https://httpd.apache.org/)) expect them to be a separate file, others (like [nginx](https://nginx.org/)) expect them concatenated to the server certificate and finally some (like [HAProxy](https://www.haproxy.org/)) expect key, certificate, and chain to be in one file.
With *pem*, your Python application can cope with all of those scenarios:

```pycon
>>> import pem
>>> certs = pem.parse_file("chain.pem")
>>> certs
[<Certificate(PEM string with SHA-1 digest '...')>, <Certificate(PEM string with SHA-1 digest '...')>]
>>> str(certs[0])
'-----BEGIN CERTIFICATE-----\n...'
```

Additionally to the vanilla parsing code, *pem* also contains helpers for [Twisted](https://docs.twistedmatrix.com/en/stable/api/twisted.internet.ssl.Certificate.html#loadPEM) that save a lot of boilerplate code.


## Project Information

- **License**: [MIT](https://github.com/hynek/pem/blob/main/LICENSE)
- [**PyPI**](https://pypi.org/project/pem/)
- [**Source Code**](https://github.com/hynek/pem)
- [**Documentation**](https://pem.readthedocs.io/)
- [**Changelog**](https://pem.readthedocs.io/en/stable/changelog.html)


### Credits

*pem* is written and maintained by [Hynek Schlawack](https://hynek.me).

The development is kindly supported by my employer [Variomedia AG](https://www.variomedia.de/) and all my amazing [GitHub Sponsors](https://github.com/sponsors/hynek).


### *pem* for Enterprise

Available as part of the Tidelift Subscription.

The maintainers of *pem* and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source packages you use to build your applications.
Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use.
[Learn more.](https://tidelift.com/?utm_source=lifter&utm_medium=referral&utm_campaign=hynek)


## Release Information


### Removed

- Support for Python 2.7, 3.5, and 3.6 has been dropped.


### Added

- Support for RFC 4880 OpenPGP private & public keys: `pem.OpenPGPPublicKey` and `pem.OpenPGPPrivateKey`.
  [#72](https://github.com/hynek/pem/issues/72)
- Support for intra-payload headers like the ones used in OpenPGP keys using the `meta_headers` property.
  [#75](https://github.com/hynek/pem/pull/75)
- `pem.parse_file()` now accepts also [`pathlib.Path`](https://docs.python.org/3/library/pathlib.html#pathlib.Path) objects.
- `pem.parse()` now also accepts `str`.
- Added `text_payload`, `bytes_payload` and `decoded_payload` properties to all PEM objects that allow to directly access the payload without the envelope and possible headers.
  [#74](https://github.com/hynek/pem/pull/74)


---

[→ Full Changelog](https://pem.readthedocs.io/en/stable/changelog.html)

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "pem",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "cryptography,pem,pyopenssl,ssl,tls,twisted",
    "author": "",
    "author_email": "Hynek Schlawack <hs@ox.cx>",
    "download_url": "https://files.pythonhosted.org/packages/05/86/16c0b6789816f8d53f2f208b5a090c9197da8a6dae4d490554bb1bedbb09/pem-23.1.0.tar.gz",
    "platform": null,
    "description": "# pem: PEM file parsing for Python\n\n\n*pem* is a Python module for parsing and splitting of [PEM files](https://en.wikipedia.org/wiki/X.509#Certificate_filename_extensions), i.e. Base64-encoded DER keys and certificates.\n\nIt has no dependencies and does not attempt to interpret the certificate data in any way.\n\nIt\u2019s born from the need to load keys, certificates, trust chains, and Diffie\u2013Hellman parameters from various certificate deployments:\nsome servers (like [Apache](https://httpd.apache.org/)) expect them to be a separate file, others (like [nginx](https://nginx.org/)) expect them concatenated to the server certificate and finally some (like [HAProxy](https://www.haproxy.org/)) expect key, certificate, and chain to be in one file.\nWith *pem*, your Python application can cope with all of those scenarios:\n\n```pycon\n>>> import pem\n>>> certs = pem.parse_file(\"chain.pem\")\n>>> certs\n[<Certificate(PEM string with SHA-1 digest '...')>, <Certificate(PEM string with SHA-1 digest '...')>]\n>>> str(certs[0])\n'-----BEGIN CERTIFICATE-----\\n...'\n```\n\nAdditionally to the vanilla parsing code, *pem* also contains helpers for [Twisted](https://docs.twistedmatrix.com/en/stable/api/twisted.internet.ssl.Certificate.html#loadPEM) that save a lot of boilerplate code.\n\n\n## Project Information\n\n- **License**: [MIT](https://github.com/hynek/pem/blob/main/LICENSE)\n- [**PyPI**](https://pypi.org/project/pem/)\n- [**Source Code**](https://github.com/hynek/pem)\n- [**Documentation**](https://pem.readthedocs.io/)\n- [**Changelog**](https://pem.readthedocs.io/en/stable/changelog.html)\n\n\n### Credits\n\n*pem* is written and maintained by [Hynek Schlawack](https://hynek.me).\n\nThe development is kindly supported by my employer [Variomedia AG](https://www.variomedia.de/) and all my amazing [GitHub Sponsors](https://github.com/sponsors/hynek).\n\n\n### *pem* for Enterprise\n\nAvailable as part of the Tidelift Subscription.\n\nThe maintainers of *pem* and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source packages you use to build your applications.\nSave time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use.\n[Learn more.](https://tidelift.com/?utm_source=lifter&utm_medium=referral&utm_campaign=hynek)\n\n\n## Release Information\n\n\n### Removed\n\n- Support for Python 2.7, 3.5, and 3.6 has been dropped.\n\n\n### Added\n\n- Support for RFC 4880 OpenPGP private & public keys: `pem.OpenPGPPublicKey` and `pem.OpenPGPPrivateKey`.\n  [#72](https://github.com/hynek/pem/issues/72)\n- Support for intra-payload headers like the ones used in OpenPGP keys using the `meta_headers` property.\n  [#75](https://github.com/hynek/pem/pull/75)\n- `pem.parse_file()` now accepts also [`pathlib.Path`](https://docs.python.org/3/library/pathlib.html#pathlib.Path) objects.\n- `pem.parse()` now also accepts `str`.\n- Added `text_payload`, `bytes_payload` and `decoded_payload` properties to all PEM objects that allow to directly access the payload without the envelope and possible headers.\n  [#74](https://github.com/hynek/pem/pull/74)\n\n\n---\n\n[\u2192 Full Changelog](https://pem.readthedocs.io/en/stable/changelog.html)\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "PEM file parsing in Python.",
    "version": "23.1.0",
    "project_urls": {
        "Changelog": "https://pem.readthedocs.io/en/stable/changelog.html",
        "Documentation": "https://pem.readthedocs.io/",
        "Funding": "https://github.com/sponsors/hynek",
        "Source Code": "https://github.com/hynek/pem",
        "Tidelift": "https://tidelift.com/?utm_source=lifter&utm_medium=referral&utm_campaign=hynek"
    },
    "split_keywords": [
        "cryptography",
        "pem",
        "pyopenssl",
        "ssl",
        "tls",
        "twisted"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c9978299a481ae6c08494b5d53511e6a4746775d8a354c685c69d8796b2ed482",
                "md5": "f5f5965294c436ea18d4dc5b6bcf5136",
                "sha256": "78bbb1e75b737891350cb9499cbba31da5d59545f360f44163c0bc751cad55d3"
            },
            "downloads": -1,
            "filename": "pem-23.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f5f5965294c436ea18d4dc5b6bcf5136",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 9195,
            "upload_time": "2023-06-21T10:24:39",
            "upload_time_iso_8601": "2023-06-21T10:24:39.164854Z",
            "url": "https://files.pythonhosted.org/packages/c9/97/8299a481ae6c08494b5d53511e6a4746775d8a354c685c69d8796b2ed482/pem-23.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "058616c0b6789816f8d53f2f208b5a090c9197da8a6dae4d490554bb1bedbb09",
                "md5": "f7fbd42398f637ef410bf8f8b7b81bde",
                "sha256": "06503ff2441a111f853ce4e8b9eb9d5fedb488ebdbf560115d3dd53a1b4afc73"
            },
            "downloads": -1,
            "filename": "pem-23.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "f7fbd42398f637ef410bf8f8b7b81bde",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 43796,
            "upload_time": "2023-06-21T10:24:40",
            "upload_time_iso_8601": "2023-06-21T10:24:40.539744Z",
            "url": "https://files.pythonhosted.org/packages/05/86/16c0b6789816f8d53f2f208b5a090c9197da8a6dae4d490554bb1bedbb09/pem-23.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-21 10:24:40",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "sponsors",
    "github_project": "hynek",
    "github_not_found": true,
    "lcname": "pem"
}
        
Elapsed time: 0.07936s