swarmauri_certservice_ms_adcs 0.2.0.dev4__tar.gz → 0.2.0.dev23__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,195 @@
1
+ Metadata-Version: 2.4
2
+ Name: swarmauri_certservice_ms_adcs
3
+ Version: 0.2.0.dev23
4
+ Summary: Microsoft AD CS certificate service client for Swarmauri
5
+ License-Expression: Apache-2.0
6
+ License-File: LICENSE
7
+ Keywords: swarmauri,certservice,ms,adcs,microsoft,certificate,service,client
8
+ Author: Jacob Stewart
9
+ Author-email: jacob@swarmauri.com
10
+ Requires-Python: >=3.10,<3.13
11
+ Classifier: License :: OSI Approved :: Apache Software License
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Natural Language :: English
16
+ Classifier: Development Status :: 3 - Alpha
17
+ Classifier: Intended Audience :: Developers
18
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
19
+ Provides-Extra: kerberos
20
+ Provides-Extra: ntlm
21
+ Provides-Extra: perf
22
+ Requires-Dist: cryptography
23
+ Requires-Dist: pytest-benchmark (>=4.0.0) ; extra == "perf"
24
+ Requires-Dist: requests (>=2.32.3)
25
+ Requires-Dist: requests-kerberos ; extra == "kerberos"
26
+ Requires-Dist: requests-ntlm ; extra == "ntlm"
27
+ Requires-Dist: swarmauri_base
28
+ Requires-Dist: swarmauri_core
29
+ Requires-Dist: swarmauri_standard
30
+ Description-Content-Type: text/markdown
31
+
32
+ ![Swarmauri Logo](https://github.com/swarmauri/swarmauri-sdk/blob/3d4d1cfa949399d7019ae9d8f296afba773dfb7f/assets/swarmauri.brand.theme.svg)
33
+
34
+ <p align="center">
35
+ <a href="https://pypi.org/project/swarmauri_certservice_ms_adcs/">
36
+ <img src="https://img.shields.io/pypi/dm/swarmauri_certservice_ms_adcs" alt="PyPI - Downloads"/></a>
37
+ <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_certservice_ms_adcs/">
38
+ <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_certservice_ms_adcs.svg"/></a>
39
+ <a href="https://pypi.org/project/swarmauri_certservice_ms_adcs/">
40
+ <img src="https://img.shields.io/pypi/pyversions/swarmauri_certservice_ms_adcs" alt="PyPI - Python Version"/></a>
41
+ <a href="https://pypi.org/project/swarmauri_certservice_ms_adcs/">
42
+ <img src="https://img.shields.io/pypi/l/swarmauri_certservice_ms_adcs" alt="PyPI - License"/></a>
43
+ <a href="https://pypi.org/project/swarmauri_certservice_ms_adcs/">
44
+ <img src="https://img.shields.io/pypi/v/swarmauri_certservice_ms_adcs?label=swarmauri_certservice_ms_adcs&color=green" alt="PyPI - swarmauri_certservice_ms_adcs"/></a>
45
+
46
+ </p>
47
+
48
+ ---
49
+
50
+ # swarmauri_certservice_ms_adcs
51
+
52
+ Community plugin providing a certificate service client for Microsoft Active Directory Certificate Services (AD CS).
53
+
54
+ ## Features
55
+
56
+ - Generate RFC 2986-compliant PKCS#10 CSRs with rich subject, subject alternative name, and extension options.
57
+ - Parse and validate X.509 certificates per RFC 5280, including issuer matching and signature verification.
58
+ - Ready-to-use authentication helpers for NTLM, Kerberos, and HTTP basic auth while preserving TLS configuration.
59
+ - Typed `supports()` metadata describing templates, key algorithms, and capabilities advertised to Swarmauri agents.
60
+
61
+ ## Prerequisites
62
+
63
+ - Python 3.10 or newer.
64
+ - Network access to an AD CS Web Enrollment endpoint (typically `https://<ca>/certsrv`).
65
+ - A private key for each CSR you plan to submit; software keys can be read from PEM while HSM-backed keys can be referenced via `KeyRef` metadata.
66
+ - Optional authentication libraries: install `requests-ntlm` for NTLM flows and `requests-kerberos` for Kerberos/SPNEGO delegation.
67
+
68
+ ## Installation
69
+
70
+ Install the core package or include extras for the auth helpers your environment requires:
71
+
72
+ ```bash
73
+ # pip
74
+ pip install "swarmauri_certservice_ms_adcs[ntlm,kerberos]"
75
+
76
+ # poetry
77
+ poetry add swarmauri_certservice_ms_adcs -E ntlm -E kerberos
78
+
79
+ # uv (pyproject-based projects)
80
+ uv add "swarmauri_certservice_ms_adcs[ntlm,kerberos]"
81
+ ```
82
+
83
+ You can drop the extras if your AD CS deployment only needs anonymous access or HTTP basic authentication.
84
+
85
+ ## Quickstart: Build a CSR for AD CS
86
+
87
+ ```python
88
+ import asyncio
89
+ from pathlib import Path
90
+
91
+ from swarmauri_certservice_ms_adcs import MsAdcsCertService, _AuthCfg
92
+ from swarmauri_core.certs.ICertService import SubjectSpec
93
+ from swarmauri_core.crypto.types import ExportPolicy, KeyRef, KeyType, KeyUse
94
+
95
+
96
+ async def main() -> None:
97
+ service = MsAdcsCertService(
98
+ base_url="https://ca.example.com/certsrv",
99
+ default_template="WebServer",
100
+ auth=_AuthCfg(
101
+ mode="ntlm",
102
+ username="EXAMPLE\\svc-adcs",
103
+ password="s3cr3t!",
104
+ verify_tls=True,
105
+ ),
106
+ )
107
+
108
+ key_bytes = Path("webserver.key.pem").read_bytes()
109
+ key_ref = KeyRef(
110
+ kid="webserver-key",
111
+ version=1,
112
+ type=KeyType.RSA,
113
+ uses=(KeyUse.SIGN,),
114
+ export_policy=ExportPolicy.PUBLIC_ONLY,
115
+ material=key_bytes,
116
+ )
117
+
118
+ subject: SubjectSpec = {
119
+ "C": "US",
120
+ "ST": "Texas",
121
+ "L": "Austin",
122
+ "O": "Example Corp",
123
+ "CN": "app.example.com",
124
+ }
125
+
126
+ csr_pem = await service.create_csr(
127
+ key=key_ref,
128
+ subject=subject,
129
+ san={"dns": ["app.example.com", "www.example.com"]},
130
+ )
131
+
132
+ Path("app.csr").write_bytes(csr_pem)
133
+ print("CSR saved to app.csr")
134
+
135
+
136
+ if __name__ == "__main__":
137
+ asyncio.run(main())
138
+ ```
139
+
140
+ Submit `app.csr` through your AD CS Web Enrollment UI, automation, or a downstream Swarmauri agent responsible for certificate issuance.
141
+
142
+ ## Validate Issued Certificates
143
+
144
+ After AD CS returns a certificate, use the same service instance to confirm the chain and inspect metadata:
145
+
146
+ ```python
147
+ import asyncio
148
+ from pathlib import Path
149
+
150
+ from swarmauri_certservice_ms_adcs import MsAdcsCertService, _AuthCfg
151
+
152
+
153
+ async def verify_certificate() -> None:
154
+ service = MsAdcsCertService(
155
+ base_url="https://ca.example.com/certsrv",
156
+ auth=_AuthCfg(mode="none"),
157
+ )
158
+
159
+ issued_cert = Path("app.pem").read_bytes()
160
+ issuing_ca = Path("issuing-ca.pem").read_bytes()
161
+
162
+ verification = await service.verify_cert(
163
+ cert=issued_cert,
164
+ trust_roots=[issuing_ca],
165
+ )
166
+ if verification["valid"]:
167
+ print("Certificate is valid until", verification["not_after"])
168
+ else:
169
+ print("Validation failed:", verification["reason"])
170
+
171
+ parsed = await service.parse_cert(issued_cert)
172
+ print("Subject:", parsed["subject"])
173
+ print("Subject Alternative Names:", parsed.get("san"))
174
+
175
+
176
+ if __name__ == "__main__":
177
+ asyncio.run(verify_certificate())
178
+ ```
179
+
180
+ `verify_cert` performs structural checks and signature validation when an issuer certificate is supplied, while `parse_cert` surfaces extension data for auditing or observability pipelines.
181
+
182
+ ## Authentication Modes
183
+
184
+ - **NTLM** – enable by installing `requests-ntlm` and providing domain credentials via `_AuthCfg(mode="ntlm", username="DOMAIN\\user", password="..." )`.
185
+ - **Kerberos/SPNEGO** – install `requests-kerberos` and set `_AuthCfg(mode="kerberos", spnego_delegate=True)` when delegation is required.
186
+ - **HTTP Basic** – provide `_AuthCfg(mode="basic", username=..., password=...)` for AD CS deployments fronted by basic auth proxies.
187
+ - **Anonymous** – set `_AuthCfg(mode="none")` for environments that rely on IP allow lists or mutual TLS.
188
+
189
+ ## Best Practices
190
+
191
+ - Store AD CS credentials in a secure secrets manager and inject them via environment variables rather than hard-coding passwords.
192
+ - Capture issued certificates, verification results, and parsed metadata in your logging system so you can trace enrollment activity.
193
+ - Rotate key pairs and certificates regularly; regenerate CSRs ahead of expiry to leave time for manual approvals.
194
+ - Combine this plugin with Swarmauri certificate verification agents (CRL/OCSP) to maintain revocation visibility across the lifecycle.
195
+
@@ -0,0 +1,163 @@
1
+ ![Swarmauri Logo](https://github.com/swarmauri/swarmauri-sdk/blob/3d4d1cfa949399d7019ae9d8f296afba773dfb7f/assets/swarmauri.brand.theme.svg)
2
+
3
+ <p align="center">
4
+ <a href="https://pypi.org/project/swarmauri_certservice_ms_adcs/">
5
+ <img src="https://img.shields.io/pypi/dm/swarmauri_certservice_ms_adcs" alt="PyPI - Downloads"/></a>
6
+ <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_certservice_ms_adcs/">
7
+ <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_certservice_ms_adcs.svg"/></a>
8
+ <a href="https://pypi.org/project/swarmauri_certservice_ms_adcs/">
9
+ <img src="https://img.shields.io/pypi/pyversions/swarmauri_certservice_ms_adcs" alt="PyPI - Python Version"/></a>
10
+ <a href="https://pypi.org/project/swarmauri_certservice_ms_adcs/">
11
+ <img src="https://img.shields.io/pypi/l/swarmauri_certservice_ms_adcs" alt="PyPI - License"/></a>
12
+ <a href="https://pypi.org/project/swarmauri_certservice_ms_adcs/">
13
+ <img src="https://img.shields.io/pypi/v/swarmauri_certservice_ms_adcs?label=swarmauri_certservice_ms_adcs&color=green" alt="PyPI - swarmauri_certservice_ms_adcs"/></a>
14
+
15
+ </p>
16
+
17
+ ---
18
+
19
+ # swarmauri_certservice_ms_adcs
20
+
21
+ Community plugin providing a certificate service client for Microsoft Active Directory Certificate Services (AD CS).
22
+
23
+ ## Features
24
+
25
+ - Generate RFC 2986-compliant PKCS#10 CSRs with rich subject, subject alternative name, and extension options.
26
+ - Parse and validate X.509 certificates per RFC 5280, including issuer matching and signature verification.
27
+ - Ready-to-use authentication helpers for NTLM, Kerberos, and HTTP basic auth while preserving TLS configuration.
28
+ - Typed `supports()` metadata describing templates, key algorithms, and capabilities advertised to Swarmauri agents.
29
+
30
+ ## Prerequisites
31
+
32
+ - Python 3.10 or newer.
33
+ - Network access to an AD CS Web Enrollment endpoint (typically `https://<ca>/certsrv`).
34
+ - A private key for each CSR you plan to submit; software keys can be read from PEM while HSM-backed keys can be referenced via `KeyRef` metadata.
35
+ - Optional authentication libraries: install `requests-ntlm` for NTLM flows and `requests-kerberos` for Kerberos/SPNEGO delegation.
36
+
37
+ ## Installation
38
+
39
+ Install the core package or include extras for the auth helpers your environment requires:
40
+
41
+ ```bash
42
+ # pip
43
+ pip install "swarmauri_certservice_ms_adcs[ntlm,kerberos]"
44
+
45
+ # poetry
46
+ poetry add swarmauri_certservice_ms_adcs -E ntlm -E kerberos
47
+
48
+ # uv (pyproject-based projects)
49
+ uv add "swarmauri_certservice_ms_adcs[ntlm,kerberos]"
50
+ ```
51
+
52
+ You can drop the extras if your AD CS deployment only needs anonymous access or HTTP basic authentication.
53
+
54
+ ## Quickstart: Build a CSR for AD CS
55
+
56
+ ```python
57
+ import asyncio
58
+ from pathlib import Path
59
+
60
+ from swarmauri_certservice_ms_adcs import MsAdcsCertService, _AuthCfg
61
+ from swarmauri_core.certs.ICertService import SubjectSpec
62
+ from swarmauri_core.crypto.types import ExportPolicy, KeyRef, KeyType, KeyUse
63
+
64
+
65
+ async def main() -> None:
66
+ service = MsAdcsCertService(
67
+ base_url="https://ca.example.com/certsrv",
68
+ default_template="WebServer",
69
+ auth=_AuthCfg(
70
+ mode="ntlm",
71
+ username="EXAMPLE\\svc-adcs",
72
+ password="s3cr3t!",
73
+ verify_tls=True,
74
+ ),
75
+ )
76
+
77
+ key_bytes = Path("webserver.key.pem").read_bytes()
78
+ key_ref = KeyRef(
79
+ kid="webserver-key",
80
+ version=1,
81
+ type=KeyType.RSA,
82
+ uses=(KeyUse.SIGN,),
83
+ export_policy=ExportPolicy.PUBLIC_ONLY,
84
+ material=key_bytes,
85
+ )
86
+
87
+ subject: SubjectSpec = {
88
+ "C": "US",
89
+ "ST": "Texas",
90
+ "L": "Austin",
91
+ "O": "Example Corp",
92
+ "CN": "app.example.com",
93
+ }
94
+
95
+ csr_pem = await service.create_csr(
96
+ key=key_ref,
97
+ subject=subject,
98
+ san={"dns": ["app.example.com", "www.example.com"]},
99
+ )
100
+
101
+ Path("app.csr").write_bytes(csr_pem)
102
+ print("CSR saved to app.csr")
103
+
104
+
105
+ if __name__ == "__main__":
106
+ asyncio.run(main())
107
+ ```
108
+
109
+ Submit `app.csr` through your AD CS Web Enrollment UI, automation, or a downstream Swarmauri agent responsible for certificate issuance.
110
+
111
+ ## Validate Issued Certificates
112
+
113
+ After AD CS returns a certificate, use the same service instance to confirm the chain and inspect metadata:
114
+
115
+ ```python
116
+ import asyncio
117
+ from pathlib import Path
118
+
119
+ from swarmauri_certservice_ms_adcs import MsAdcsCertService, _AuthCfg
120
+
121
+
122
+ async def verify_certificate() -> None:
123
+ service = MsAdcsCertService(
124
+ base_url="https://ca.example.com/certsrv",
125
+ auth=_AuthCfg(mode="none"),
126
+ )
127
+
128
+ issued_cert = Path("app.pem").read_bytes()
129
+ issuing_ca = Path("issuing-ca.pem").read_bytes()
130
+
131
+ verification = await service.verify_cert(
132
+ cert=issued_cert,
133
+ trust_roots=[issuing_ca],
134
+ )
135
+ if verification["valid"]:
136
+ print("Certificate is valid until", verification["not_after"])
137
+ else:
138
+ print("Validation failed:", verification["reason"])
139
+
140
+ parsed = await service.parse_cert(issued_cert)
141
+ print("Subject:", parsed["subject"])
142
+ print("Subject Alternative Names:", parsed.get("san"))
143
+
144
+
145
+ if __name__ == "__main__":
146
+ asyncio.run(verify_certificate())
147
+ ```
148
+
149
+ `verify_cert` performs structural checks and signature validation when an issuer certificate is supplied, while `parse_cert` surfaces extension data for auditing or observability pipelines.
150
+
151
+ ## Authentication Modes
152
+
153
+ - **NTLM** – enable by installing `requests-ntlm` and providing domain credentials via `_AuthCfg(mode="ntlm", username="DOMAIN\\user", password="..." )`.
154
+ - **Kerberos/SPNEGO** – install `requests-kerberos` and set `_AuthCfg(mode="kerberos", spnego_delegate=True)` when delegation is required.
155
+ - **HTTP Basic** – provide `_AuthCfg(mode="basic", username=..., password=...)` for AD CS deployments fronted by basic auth proxies.
156
+ - **Anonymous** – set `_AuthCfg(mode="none")` for environments that rely on IP allow lists or mutual TLS.
157
+
158
+ ## Best Practices
159
+
160
+ - Store AD CS credentials in a secure secrets manager and inject them via environment variables rather than hard-coding passwords.
161
+ - Capture issued certificates, verification results, and parsed metadata in your logging system so you can trace enrollment activity.
162
+ - Rotate key pairs and certificates regularly; regenerate CSRs ahead of expiry to leave time for manual approvals.
163
+ - Combine this plugin with Swarmauri certificate verification agents (CRL/OCSP) to maintain revocation visibility across the lifecycle.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "swarmauri_certservice_ms_adcs"
3
- version = "0.2.0.dev4"
3
+ version = "0.2.0.dev23"
4
4
  description = "Microsoft AD CS certificate service client for Swarmauri"
5
5
  license = "Apache-2.0"
6
6
  readme = "README.md"
@@ -11,8 +11,12 @@ classifiers = [
11
11
  "Programming Language :: Python :: 3.10",
12
12
  "Programming Language :: Python :: 3.11",
13
13
  "Programming Language :: Python :: 3.12",
14
+ "Natural Language :: English",
15
+ "Development Status :: 3 - Alpha",
16
+ "Intended Audience :: Developers",
17
+ "Topic :: Software Development :: Libraries :: Application Frameworks",
14
18
  ]
15
- authors = [{ name = "Swarmauri", email = "opensource@swarmauri.com" }]
19
+ authors = [{ name = "Jacob Stewart", email = "jacob@swarmauri.com" }]
16
20
  dependencies = [
17
21
  "requests>=2.32.3",
18
22
  "cryptography",
@@ -20,11 +24,20 @@ dependencies = [
20
24
  "swarmauri_base",
21
25
  "swarmauri_standard",
22
26
  ]
27
+ keywords = [
28
+ "swarmauri",
29
+ "certservice",
30
+ "ms",
31
+ "adcs",
32
+ "microsoft",
33
+ "certificate",
34
+ "service",
35
+ "client",
36
+ ]
23
37
 
24
38
  [project.optional-dependencies]
25
39
  ntlm = ["requests-ntlm"]
26
40
  kerberos = ["requests-kerberos"]
27
- docs = ["mkdocs"]
28
41
  perf = ["pytest-benchmark>=4.0.0"]
29
42
 
30
43
  [tool.uv.sources]
@@ -1,52 +0,0 @@
1
- Metadata-Version: 2.3
2
- Name: swarmauri_certservice_ms_adcs
3
- Version: 0.2.0.dev4
4
- Summary: Microsoft AD CS certificate service client for Swarmauri
5
- License: Apache-2.0
6
- Author: Swarmauri
7
- Author-email: opensource@swarmauri.com
8
- Requires-Python: >=3.10,<3.13
9
- Classifier: License :: OSI Approved :: Apache Software License
10
- Classifier: Programming Language :: Python :: 3.10
11
- Classifier: Programming Language :: Python :: 3.11
12
- Classifier: Programming Language :: Python :: 3.12
13
- Provides-Extra: docs
14
- Provides-Extra: kerberos
15
- Provides-Extra: ntlm
16
- Provides-Extra: perf
17
- Requires-Dist: cryptography
18
- Requires-Dist: mkdocs ; extra == "docs"
19
- Requires-Dist: pytest-benchmark (>=4.0.0) ; extra == "perf"
20
- Requires-Dist: requests (>=2.32.3)
21
- Requires-Dist: requests-kerberos ; extra == "kerberos"
22
- Requires-Dist: requests-ntlm ; extra == "ntlm"
23
- Requires-Dist: swarmauri_base
24
- Requires-Dist: swarmauri_core
25
- Requires-Dist: swarmauri_standard
26
- Description-Content-Type: text/markdown
27
-
28
- # swarmauri_certservice_ms_adcs
29
-
30
- Community plugin providing a certificate service client for Microsoft Active Directory Certificate Services (AD CS).
31
-
32
- ## Features
33
-
34
- - Build and sign PKCS#10 certificate signing requests (CSR) according to RFC 2986.
35
- - Parse and verify X.509 certificates as defined in RFC 5280.
36
- - Optional authentication helpers for NTLM and Kerberos.
37
-
38
- ## Installation
39
-
40
- ```bash
41
- pip install swarmauri_certservice_ms_adcs[ntlm,kerberos]
42
- ```
43
-
44
- ## Usage
45
-
46
- ```python
47
- from swarmauri_certservice_ms_adcs import MsAdcsCertService, _AuthCfg
48
-
49
- svc = MsAdcsCertService(base_url="https://adcs.example.com/certsrv",
50
- auth=_AuthCfg(mode="none"))
51
- ```
52
-
@@ -1,24 +0,0 @@
1
- # swarmauri_certservice_ms_adcs
2
-
3
- Community plugin providing a certificate service client for Microsoft Active Directory Certificate Services (AD CS).
4
-
5
- ## Features
6
-
7
- - Build and sign PKCS#10 certificate signing requests (CSR) according to RFC 2986.
8
- - Parse and verify X.509 certificates as defined in RFC 5280.
9
- - Optional authentication helpers for NTLM and Kerberos.
10
-
11
- ## Installation
12
-
13
- ```bash
14
- pip install swarmauri_certservice_ms_adcs[ntlm,kerberos]
15
- ```
16
-
17
- ## Usage
18
-
19
- ```python
20
- from swarmauri_certservice_ms_adcs import MsAdcsCertService, _AuthCfg
21
-
22
- svc = MsAdcsCertService(base_url="https://adcs.example.com/certsrv",
23
- auth=_AuthCfg(mode="none"))
24
- ```