cryptocerts


Namecryptocerts JSON
Version 0.0.1a3 PyPI version JSON
download
home_page
SummarySimpler certificate objects
upload_time2024-02-08 01:24:28
maintainer
docs_urlNone
author
requires_python>=3.10
licenseMIT License Copyright (c) 2024 Alexander Freyr Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords certificates cryptography validate x509
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Library that wraps around the `cryptography` library, aiming to simplify the loading and validation of certificates. Providing a more streamlined interface instead of delving into the intricacies of certificate operations.

*Note* that this project is still not meant for production-use scenarios, use it at your own risk.

## Installation

This library is available on the python package index, you can install it like via `pip`

```bash
pip install cryptocerts
```

## Contributing

Community contributes are welcome. Please use the Github issue tracker for any feature, requests or bugs you might encounter.

## Usage

### Loading a certificate

Easier loading a certificate without having to know which format it is

```python
from cryptocerts import CertificateToken

# From a file
certificate = CertificateToken.load_from_file("filepath/mycert.crt")

# From bytes
certificate = CertificateToken(b"<certificate bytes>")
```

### Validate a certificate with a custom certificate store

Validate that a certificate is valid up to a custom trusted root

```python
from cryptocerts import (
    CertificateToken,
    CertificateValidator,
    CertificatesStore
)

my_trusted_roots : list[CertificateToken] = [ ... ]
my_intermediate_certificates : list[CertificateTokens] = [ ... ]
certificates_store = CertificatesStore(my_trusted_roots, my_intermediate_certificates)
certificate_validator = CertificateValidator(certificates_store)

# `result` contains validation info about the certificate, 
# f.x. a valid certificate
result = certificate_validator.verify_certificate(certificate)
result.validation_conclusion # ValidationStatus.VALID
result.valid_to_trusted_root # True
result.certificate_validation_result[0].certificate_token # <certificate>
result.certificate_validation_result[0].validation_errors # []

# and an invalid certificate
result = certificate_validator.verify_certificate(invalid_certificate)
result.validation_conclusion # ValidationStatus.INVALID
result.valid_to_trusted_root # True
result.certificate_validation_result[0].certificate_token # <invalid_certificate>
result.certificate_validation_result[0].validation_errors # [ValidatorErrors.EXPIRED]
```
            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "cryptocerts",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "",
    "keywords": "certificates,cryptography,validate,x509",
    "author": "",
    "author_email": "Alexander Freyr <alex@alexfreyr.com>",
    "download_url": "https://files.pythonhosted.org/packages/f2/10/feb1b64aed7d51ab6844ede7fc2bd582921662c8b1a41d207ac679b08bf8/cryptocerts-0.0.1a3.tar.gz",
    "platform": null,
    "description": "Library that wraps around the `cryptography` library, aiming to simplify the loading and validation of certificates. Providing a more streamlined interface instead of delving into the intricacies of certificate operations.\n\n*Note* that this project is still not meant for production-use scenarios, use it at your own risk.\n\n## Installation\n\nThis library is available on the python package index, you can install it like via `pip`\n\n```bash\npip install cryptocerts\n```\n\n## Contributing\n\nCommunity contributes are welcome. Please use the Github issue tracker for any feature, requests or bugs you might encounter.\n\n## Usage\n\n### Loading a certificate\n\nEasier loading a certificate without having to know which format it is\n\n```python\nfrom cryptocerts import CertificateToken\n\n# From a file\ncertificate = CertificateToken.load_from_file(\"filepath/mycert.crt\")\n\n# From bytes\ncertificate = CertificateToken(b\"<certificate bytes>\")\n```\n\n### Validate a certificate with a custom certificate store\n\nValidate that a certificate is valid up to a custom trusted root\n\n```python\nfrom cryptocerts import (\n    CertificateToken,\n    CertificateValidator,\n    CertificatesStore\n)\n\nmy_trusted_roots : list[CertificateToken] = [ ... ]\nmy_intermediate_certificates : list[CertificateTokens] = [ ... ]\ncertificates_store = CertificatesStore(my_trusted_roots, my_intermediate_certificates)\ncertificate_validator = CertificateValidator(certificates_store)\n\n# `result` contains validation info about the certificate, \n# f.x. a valid certificate\nresult = certificate_validator.verify_certificate(certificate)\nresult.validation_conclusion # ValidationStatus.VALID\nresult.valid_to_trusted_root # True\nresult.certificate_validation_result[0].certificate_token # <certificate>\nresult.certificate_validation_result[0].validation_errors # []\n\n# and an invalid certificate\nresult = certificate_validator.verify_certificate(invalid_certificate)\nresult.validation_conclusion # ValidationStatus.INVALID\nresult.valid_to_trusted_root # True\nresult.certificate_validation_result[0].certificate_token # <invalid_certificate>\nresult.certificate_validation_result[0].validation_errors # [ValidatorErrors.EXPIRED]\n```",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 Alexander Freyr  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "Simpler certificate objects",
    "version": "0.0.1a3",
    "project_urls": {
        "Homepage": "https://github.com/AlexanderFL/cryptocerts",
        "Issues": "https://github.com/AlexanderFL/cryptocerts/issues"
    },
    "split_keywords": [
        "certificates",
        "cryptography",
        "validate",
        "x509"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "55aeab0206748c79615cf26f311d9e15576905d209b61e776e035a9c47156f9e",
                "md5": "76bc52e880a6c05c6d29a161dae21136",
                "sha256": "b8c156e45faf2bdd161e70892ca2f6ed002cefdc98a79f0c0e440fbde20441ee"
            },
            "downloads": -1,
            "filename": "cryptocerts-0.0.1a3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "76bc52e880a6c05c6d29a161dae21136",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 12677,
            "upload_time": "2024-02-08T01:24:26",
            "upload_time_iso_8601": "2024-02-08T01:24:26.998741Z",
            "url": "https://files.pythonhosted.org/packages/55/ae/ab0206748c79615cf26f311d9e15576905d209b61e776e035a9c47156f9e/cryptocerts-0.0.1a3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f210feb1b64aed7d51ab6844ede7fc2bd582921662c8b1a41d207ac679b08bf8",
                "md5": "2a49f1197eea49ce41ee3c267802caff",
                "sha256": "c78d2eea21e7f294a2d70cffd92803149e921614e3168aabbd2b823e881107b4"
            },
            "downloads": -1,
            "filename": "cryptocerts-0.0.1a3.tar.gz",
            "has_sig": false,
            "md5_digest": "2a49f1197eea49ce41ee3c267802caff",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 34457,
            "upload_time": "2024-02-08T01:24:28",
            "upload_time_iso_8601": "2024-02-08T01:24:28.506430Z",
            "url": "https://files.pythonhosted.org/packages/f2/10/feb1b64aed7d51ab6844ede7fc2bd582921662c8b1a41d207ac679b08bf8/cryptocerts-0.0.1a3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-08 01:24:28",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "AlexanderFL",
    "github_project": "cryptocerts",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "cryptocerts"
}
        
Elapsed time: 0.17605s