Skip to main content

Remote CA certificate service for Swarmauri

Project description

Swarmauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_certs_remote_ca Discord

Swarmauri Remote CA Cert Service

A certificate enrollment bridge implementing the ICertService interface and forwarding CSRs to a remote Certificate Authority.

Features

  • Posts CSRs to a remote endpoint and returns issued certificates.
  • Minimal parsing helpers for certificate snippets.
  • Designed around X.509 as defined in RFC 5280 and Enrollment over Secure Transport (EST) in RFC 7030.

Installation

Install the package with your preferred Python packaging tool:

pip install swarmauri_certs_remote_ca
poetry add swarmauri_certs_remote_ca
uv pip install swarmauri_certs_remote_ca

Configuration

RemoteCaCertService accepts the following arguments:

  • endpoint ? Base URL of the remote CA sign endpoint.
  • auth ? Optional mapping of HTTP headers or an httpx.Auth instance for authentication.
  • timeout_s ? HTTP timeout in seconds (default 10).
  • ca_chain ? Optional sequence of cached trust anchors exposed during verification and parsing.

Entry Point

The service registers under the swarmauri.certs entry point as RemoteCaCertService.

Usage

The service is asynchronous and expects an existing CSR (certificate signing request) in PEM or DER form. Configure the remote CA endpoint and submit the CSR to receive the issued certificate:

import asyncio
import base64
import json

import httpx

from swarmauri_certs_remote_ca import RemoteCaCertService

csr = b"example-csr"
cert_bytes = b"example-cert"


async def main() -> None:
    async def handler(request: httpx.Request) -> httpx.Response:
        data = json.loads(request.content)
        assert base64.b64decode(data["csr"]) == csr
        return httpx.Response(
            200,
            json={"cert": base64.b64encode(cert_bytes).decode("ascii")},
        )

    svc = RemoteCaCertService("https://ca.example/sign")

    async with httpx.AsyncClient(transport=httpx.MockTransport(handler)) as client:
        svc._client = client  # Inject mock transport for the example.
        certificate = await svc.sign_cert(csr, {"kind": "dummy"})
        print(certificate)


asyncio.run(main())

The example above mocks a CA using httpx.MockTransport. In real scenarios RemoteCaCertService posts the CSR to the configured endpoint and returns the certificate bytes supplied by the remote CA.

When used against a real service, provide any required authentication headers through the auth argument and override request or response formats via the opts parameter of sign_cert.

Want to help?

If you want to contribute to swarmauri-sdk, read up on our guidelines for contributing that will help you get started.

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

swarmauri_certs_remote_ca-0.11.0.dev1.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

swarmauri_certs_remote_ca-0.11.0.dev1-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file swarmauri_certs_remote_ca-0.11.0.dev1.tar.gz.

File metadata

  • Download URL: swarmauri_certs_remote_ca-0.11.0.dev1.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for swarmauri_certs_remote_ca-0.11.0.dev1.tar.gz
Algorithm Hash digest
SHA256 1f0da415401930b327a1950c1ec64426c4ece7382845c2683b81389d19e3e1be
MD5 2a320280982371b7c1f386154eae57ab
BLAKE2b-256 19cecbfe50db53d4d5144c8d78e3617c3775b98b5766fb26508944779ba23d3d

See more details on using hashes here.

File details

Details for the file swarmauri_certs_remote_ca-0.11.0.dev1-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_certs_remote_ca-0.11.0.dev1-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for swarmauri_certs_remote_ca-0.11.0.dev1-py3-none-any.whl
Algorithm Hash digest
SHA256 84b79cb46d0ec784a3688a9d462ab6ca167de26ea074fbd0d0e7657fc12547ec
MD5 bd476b73fb3ae61e3977c64ef1b3168e
BLAKE2b-256 033a9b75cfeb2211547f3805fd80090ac7c9925d9e37d3e7f913b72364c6fe78

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page